I’m trying to serialize a Doctrine_query object in Symfony :
var_dump(serialize($this->pager->getQuery()));
The result is :
string(2) "N;"
What am I doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can not serialize every object in PHP. Objects themselves – by implementing the
Serializeableinterface PHP Manual – can protect themselves from being serialized for example.They return a
NULLvalue then (or don’t return anything which is thenNULLin PHP). And that’s exactly the contents of your serialized string: a serializedNULL(N;).And there are even some build-in classes that go even further than that. But it applies as well to user-defined classes and build-in classes: Some of them are not available for serialization.
One example of a built-in class that can not be serialized in PHP is
DOMDocument, however it is possible to add the functionality as the following question demonstrates: