in symfony 2.6 project have api mobile app gives possibility add , object lots of data.
main form consists of collection of other forms. each of child forms have same things, 4 in total. structure looks this:
master form has child1 forsm has child2 forms has child3 forms.
the object has instance 2 000 entities child3, 8 child2 entities, 3 child1 entities , 1 master entity.
many times error while saving data:
ah01071: got error 'php message: php fatal error: allowed memory size of 536870912 bytes exhausted (tried allocate 88 bytes) in /vendor/symfony/symfony/src/symfony/component/optionsresolver/optionsresolver.php on line 755\n'
i have add types forms elements, like:
$buider->add('startlangutude', 'text')
also have turned off sqllogger. there other neat solution here? have experience in , share?
i suggest drop form
approach , use simple json_decode
array (it's cheaper resource wise compared object), create bunch of arraytoentitytransformer
using strategypattern
. in each strategy can validate given array before object creation process. if object valid, use doctrine batch processing recommendations save memory clearing entitymanager
after each batch.
good luck.
Comments
Post a Comment