/** * Действие при создании ноды. * * @param Node $node */ public function createNode(Node $node) { $em = $this->container->get('doctrine.orm.entity_manager'); $item = new Item(); $item->setUser($this->container->get('security.token_storage')->getToken()->getUser()); $em->persist($item); $em->flush($item); $node->setParams(['text_item_id' => $item->getId(), 'editor' => true]); }
/** * Constructor. */ public function __construct(Item $item = null) { if ($item) { $this->editor = $item->getEditor(); $this->item_id = $item->getId(); $this->locale = $item->getLocale(); $this->meta = $item->getMeta(); $this->text = $item->getText(); $this->user = $item->getUser(); } $this->created_at = new \DateTime(); }