php - Symfony Form Collections with ODM and ORM -


a task entity requires ability set tag document.

namespace appbundle\entity;  class task {     protected $description;      protected $tagid;      public function getdescription()     public function setdescription($description)      //mongo id     public function settagid($tagid)     {         $this->tagid = $tagid;         return $this;     }      //mongo id     public function gettagid()     {         return $this->tagid;     }  } 

based on example https://symfony.com/doc/current/form/form_collections.html uses orm both task , tag, how can tag stored in mongoodm instead?

a transformer convert user input tagdocument , call task->setid($tag->getid()). if document not exist, when should created?

creating document inside transformer work persisting seem break single responsibility principle.

likewise formevents::post_submit used form should not responsible persisting either.

how should tagdocument added taskentity?

the tagdocument , taskentity should both persisted in same request. i.e. prefer not create separate ajax request first create tagdocument , return id, result in many created never used tagdocuments.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -