Jump to content

Help with php objects being destructed in session(with ajax)


dandanbsb

Recommended Posts

Hi all :)

 

Im trying to find the solution for my problem for a while and cant find it :(

 

Here is whats happening: i have a regular class named phoneVO with three attributes, and with the respectives getters and setters. Im using php and ajax to add phonesVO objects into the session, like this:

 

function addPhone($ddd,$number,$type){
       $phones_array = $_SESSION["userPhones"];

$phoneVO = new phoneVO();
$phoneVO ->setDdd($ddd);
$phoneVO ->setTelephone($number);
$phoneVO ->setType($type);

$phones_array[count($phones_array)] = $phoneVO;

$_SESSION["userPhones"] = $phones_array;

return $phones_array;

}

 

so, each time the user clicks on a button add phone, i will call this function(with others to make a html etc) with ajax and add a phone to the user with the parameters passed.

The problem is that, as soon as i add the object to the session, it gets destructed.(i added a line on the __destruct function at phoneVO to log the time it is destructed). How can i tell PhP  to NOT destruct this objects while at session, or something like this??

 

Any ideas that can solve this??

Tnx 4 ur time :)

bye

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.