Пример #1
0
 /**
  * Действие при создании ноды.
  *
  * @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]);
 }
Пример #2
0
 /**
  * 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();
 }