Пример #1
0
 /**
  * @param RZ\Roadiz\Core\Entities\Node $node
  * @param RZ\Roadiz\Core\Entities\Tag  $tag
  *
  * @return \Symfony\Component\Form\Form
  */
 protected function buildRemoveTagForm(Node $node, Tag $tag)
 {
     $builder = $this->createFormBuilder()->add('nodeId', 'hidden', ['data' => $node->getId(), 'constraints' => [new NotBlank()]])->add('tagId', 'hidden', ['data' => $tag->getId(), 'constraints' => [new NotBlank()]]);
     return $builder->getForm();
 }
Пример #2
0
 /**
  * @param RZ\Roadiz\Core\Entities\Node $node
  *
  * @return \Symfony\Component\Form\Form
  */
 private function buildAddUrlAliasForm(Node $node)
 {
     $defaults = ['nodeId' => $node->getId()];
     $builder = $this->createFormBuilder($defaults)->add('nodeId', 'hidden', ['data' => $node->getId(), 'constraints' => [new NotBlank()]])->add('alias', 'text', ['label' => 'urlAlias'])->add('translationId', new \RZ\Roadiz\CMS\Forms\TranslationsType(), ['label' => 'translation']);
     return $builder->getForm();
 }
Пример #3
0
 /**
  * @param RZ\Roadiz\Core\Entities\Node $node
  *
  * @return array
  */
 public function findAllOffspringIdByNode(Node $node)
 {
     $theOffprings = [];
     $in = [$node->getId()];
     do {
         $theOffprings = array_merge($theOffprings, $in);
         $query = $this->_em->createQuery('
             SELECT n.id FROM RZ\\Roadiz\\Core\\Entities\\Node n
             WHERE n.parent IN (:tab)')->setParameter('tab', $in);
         $result = $query->getScalarResult();
         $in = [];
         //For memory optimizations
         foreach ($result as $item) {
             $in[] = (int) $item['id'];
         }
     } while (!empty($in));
     return $theOffprings;
 }