AnsweredAssumed Answered

Serializing FM API result objects

Question asked by Malcolm on Jul 7, 2013
Latest reply on Jul 9, 2013 by TimDietrich

Has anyone figured out how to serialise a result from the FM API and get more back than __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] ?


The manual says:
If you store a serialized object in a session, you have to include the class _before_ you initialize (session_start()) the session.


I'm starting both files with a call to FileMaker.php where the classes and objects are defined then a call to start the session is within fmview.php.



require_once 'FileMaker.php';

require_once 'fmview.php';


That seems like it should be OK but it obviously isn't.




I should add that I can work-around this like so:


$data = $result->getRecords();

$_SESSION['data'] = serialize($data);


getRecords() returns an ordinary array so it can be unserialized without fuss.