/** * Persist a new node or detach it from tree if already exists. * * @param \BackBee\NestedNode\AbstractNestedNode $node * @return \BackBee\NestedNode\Repository\NestedNodeRepository */ protected function detachOrPersistNode(AbstractNestedNode $node) { if (null !== ($refreshed = $this->find($node->getUid()))) { return $this->detachFromTree($refreshed)->refreshExistingNode($node); } if (false === $this->_em->contains($node)) { $this->_em->persist($node); } return $this; }
/** * Add query part to exclude $node from selection. * * @param \BackBee\NestedNode\AbstractNestedNode $node * @param string $alias optional, the alias to use * @return \BackBee\NestedNode\Repository\NestedNodeQueryBuilder */ public function andIsNot(AbstractNestedNode $node, $alias = null) { list($alias, $suffix) = $this->getAliasAndSuffix($alias); return $this->andWhere($alias . '._uid != :uid' . $suffix)->setParameter('uid' . $suffix, $node->getUid()); }