-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum execution time of 30 seconds exceeded #306
Comments
Today I found that it issues many SQL statements when the code runs into this function: $serializedData = $serializer->serialize($user, 'json'); Although I commented out the line //$object->__load(); in "vendor/jms/serializer/src/JMS/Serializer/EventDispatcher/Subscriber/DoctrineProxySubscriber.php", I'm sure this is caused by the LAZY LOADING but don't know if this is the correct way to suppress it. Any advice? Simon |
You might want to take a look at http://jmsyst.com/libs/serializer/master/reference/annotations |
Thanks very much pataprout. But what should I do if sometimes I want to exclude, and sometimes I want to include? For example: In some AJAX requests, I want to just return the User object, while in some other I want to return the User with the array of Phone. I thought that if I don't fetch-join the Phone table, it should not lazy-load it for me. Simon |
Thanks very much pataprout. It's going to be very useful info to me. |
I am currently using "exclusion_policy: ALL" on entity via YAML configuration but i still have the same issue. I've created a simple test entity with only three fields and I had no problems but when I use my entity which is related to others entities I still get the message "Maximum execution time of 30 seconds exceeded". Any thoughts? EDIT: I've added a pastebin link with my Controller, Entity and YAML Serialization file: EDIT2: I finally found what was wrong. It happens that the YAML Serialization file must be in the same bundle of the Entity you want to use. My bad. ;) |
Sorry for the long feedback loop. This issue is probably already solved. Thanks |
Hi Johannes,
I'm trying to integrate this bundle into my symfony2.2.*, to facilitate the JSON serialization.
All my objects are stored under MySQL and fetched with Doctrine2.
I got this error when I'm just doing a select on my "User" table with only one JOIN:
If I fetched the user object and saved into the symfony2's session first, and serialize the object retrieved from the session, it has no problem. So I'm quite sure that this was caused by the LAZY LOADING that this bundle is using. From the dev log, I can see that there are not only ONE SQL statement, but there are MANY SQL statements fetching a bunch of tables. So I believe the LAZY LOADING is helping me fetch all related table that "User" table references.
I've been searching for this on stackoverflow and got this:
http://stackoverflow.com/questions/11851197/avoiding-recursion-with-doctrine-entities-and-jmsserializer
Seems that only the last answer is the most updated because I couldn't even find the class Serializer\Handler\DoctrineProxyHandler. But by following the last answer (which got 0 marks), the problem is not solved. I think the rewrite of the DoctrineProxySubscriber class is the correct direction but the line in "parameters.yml" is not being effective.
Can you give me some hints? It is perfect if you told me somewhere to switch off the LAZY LOADING. Thanks.
Simon
The text was updated successfully, but these errors were encountered: