php - Unable to save into postgresql using symfony and doctrine with its association objects or table? -


i have save ticket ticket_attachments,ticket_comments , ticket_status_history. persist ticket object want save attachments,comments , history. using doctrine , symfony , annotations.

i have created 3 array collections in ticket mappedby , cascade remove , persist. , used inversedby in attachments, comments , history. after persisting , flush ticket being saved other objects i.e. attachments,comments , historys not saving. shows no error.

ticket.php

/**      * @orm\onetomany(targetentity="appbundle\entity\ticketattachments", mappedby="ticket", cascade={"persist", "remove"})      */     private $attachments;      /**      * @orm\onetomany(targetentity="appbundle\entity\ticketcomments", mappedby="ticket", cascade={"persist", "remove"})      */     private $comments;      /**      * @orm\onetomany(targetentity="appbundle\entity\ticketstatushistory", mappedby="ticket", cascade={"persist", "remove"})      */     private $historys;      public function __construct()     {         $this->attachments = new arraycollection();         $this->comments = new arraycollection();         $this->historys = new arraycollection();     } 

history, comments , attachments.php

/**      * @var \appbundle\entity\ticket      *      * @orm\manytoone(targetentity="appbundle\entity\ticket", inversedby="historys")      * @orm\joincolumns({      *   @orm\joincolumn(name="ticket_id", referencedcolumnname="id")      * })      */     private $ticket; 

all have it's setter , getter. problem?

are setting them each other? in:

public function addtohistories($history) {    $this->historys[] = $history;    $history->setticket($this); } 

they have associated each other within setters (or other way) cascade persist work.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -