@param HasNodeInterface $hasNode

@return NodeVersion
764773
public function getNodeVersionFor(HasNodeInterface $hasNode)
    {
        return $this->findOneBy(
            array(
                'refId' => $hasNode->getId(),
                'refEntityName' => ClassLookup::getClass($hasNode),
            )
        );
    }
401048
public function addNodeVersion(NodeVersion $nodeVersion)
    {
        $this->nodeVersions[] = $nodeVersion;
        $nodeVersion->setNodeTranslation($this);

        if ($nodeVersion->getType() == 'public') {
            $this->publicNodeVersion = $nodeVersion;
        }

        return $this;
    }
32552
protected function getNodeVersionLocksByNodeTranslation(NodeTranslation $nodeTranslation, $isPublicVersion, BaseUser $userToExclude = null)
    {
        $threshold = $this->container->getParameter('kunstmaan_node.lock_threshold');
        /** @var NodeVersionLockRepository $objectRepository */
        $objectRepository = $this->objectManager->getRepository('KunstmaanNodeBundle:NodeVersionLock');

        return $objectRepository->getLocksForNodeTranslation($nodeTranslation, $isPublicVersion, $threshold, $userToExclude);
    }
384902
public function getVersions(EntityInterface $entity)
    {
        $primaryKey = (array)$this->_table->getPrimaryKey();

        $query = $this->_table->find('versions');
        $pkValue = $entity->extract($primaryKey);
        $conditions = [];
        foreach ($pkValue as $key => $value) {
            $field = current($query->aliasField($key));
            $conditions[$field] = $value;
        }
        $entities = $query->where($conditions)->all();

        if (empty($entities)) {
            return new Collection([]);
        }

        $entity = $entities->first();

        return $entity->get('_versions');
    }
969770
private function isNodeVersionLocked(NodeTranslation $nodeTranslation, $isPublic)
    {
        if ($this->container->getParameter('kunstmaan_node.lock_enabled')) {
            /** @var NodeVersionLockHelper $nodeVersionLockHelper */
            $nodeVersionLockHelper = $this->get('kunstmaan_node.admin_node.node_version_lock_helper');
            $nodeVersionIsLocked = $nodeVersionLockHelper->isNodeVersionLocked($this->getUser(), $nodeTranslation, $isPublic);

            return $nodeVersionIsLocked;
        }

        return false;
    }
626817
public function detectVersion(string $useragent): VersionInterface
    {
        if (preg_match('/(?:Puffin%20Free|Puffin)\/([\d\.]+)/', $useragent, $matches)) {
            return (new VersionFactory())->set($matches[1]);
        }

        return (new VersionFactory())->set('0');
    }
1023477
public function hasOne($hasOne = null)
    {
        if ($hasOne === null)
        {
            return $this->_hasOne;
        }
        $this->_hasOne = $hasOne;

        return $this;
    }
173506
public function removeNode(NodeInterface $node): NodeInterface
    {
        unset($this->_nodes[$node->getId()]);

        if ($this->getParent()) {
            $this->getParent()->removeNode($node);
        }

        return $this;
    }
1307811
public function copyBefore(NodeInterface $referenceNode, $nodeName): NodeInterface
    {
        if ($referenceNode->getParent()->getNode($nodeName) !== null) {
            throw new NodeExistsException(sprintf('Node with path "%s/%s" already exists.', $referenceNode->getParent()->getPath(), $nodeName), 1292503465);
        }

        if (!$referenceNode->getParent()->isNodeTypeAllowedAsChildNode($this->getNodeType())) {
            throw new NodeConstraintException(sprintf('Cannot copy %s before %s', $this, $referenceNode), 1402050232);
        }

        $this->emitBeforeNodeCopy($this, $referenceNode->getParent());
        $copiedNode = $this->createRecursiveCopy($referenceNode->getParent(), $nodeName, $this->getNodeType()->isAggregate());
        $copiedNode->moveBefore($referenceNode);

        $this->context->getFirstLevelNodeCache()->flush();
        $this->emitNodeAdded($copiedNode);
        $this->emitAfterNodeCopy($copiedNode, $referenceNode->getParent());

        return $copiedNode;
    }
49554
public function setVersionName(ContentInterface $node)
    {
        $date = new \DateTime("now");
        $versionName = $node->getName().'_'. $date->format("Y-m-d_H:i:s");
        $node->setVersionName($versionName);

        return $node;
    }
833540
public function addNode(NodeInterface $node)
    {
        if ($this->checkChildNode($node)) {
            $this->nodes->add($node);

            $node->setPosition(count($this->getNodes()));
            $node->setParent($this);
        }

        return $this;
    }
941948
public function hasNode(NodeInterface $node, $locale)
    {
        return array_key_exists($this->getNodeLocaleKey($node->getIdentifier(), $locale), $this->nodeDocumentMap);
    }
719662
public function setDealerIdVersion($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->dealer_id_version !== $v) {
            $this->dealer_id_version = $v;
            $this->modifiedColumns[DealerShedulesVersionTableMap::DEALER_ID_VERSION] = true;
        }


        return $this;
    }
510238
public function findByHandleAndVersion($packageHandle, $packageVersion)
    {
        $result = null;
        $packageHandle = (string) $packageHandle;
        if ($packageHandle !== '') {
            $packageVersion = (string) $packageVersion;
            if ($packageVersion !== '') {
                $list = $this->createQueryBuilder('v')
                    ->innerJoin(Package::class, 'p', Expr\Join::WITH, 'v.package = p.id')
                    ->where('p.handle = :handle')->setParameter('handle', $packageHandle)
                    ->andWhere('v.version = :version')->setParameter('version', $packageVersion)
                    ->setMaxResults(1)
                    ->getQuery()->execute();
                if (!empty($list)) {
                    $result = $list[0];
                }
            }
        }

        return $result;
    }
47794
public function addNode(NodeInterface $node): NodeInterface
    {
        $this->_nodes[$node->getId()] = $node;

        if ($this->getParent()) {
            $this->getParent()->addNode($node);
        }

        return $this;
    }
900390
public function setDependencyPhpVersion($minVersion, $maxVersion)
    {
        $parent = $this->_packageXml->dependencies;
        $parent = $this->_getNode('required', $parent);
        $parent = $this->_getNode('php', $parent);
        $parent->addChild('min', $minVersion);
        $parent->addChild('max', $maxVersion);
        return $this;
    }
723395
public function fromRepository(CheckedOutRepository $checkedOutRepository) : VersionsCollection
    {
        $output = (new Process(['git', 'tag', '-l']))
            ->setWorkingDirectory($checkedOutRepository->__toString())
            ->mustRun()
            ->getOutput();

        return new VersionsCollection(...array_filter(
            array_map(static function (string $maybeVersion) : ?Version {
                try {
                    return Version::fromString($maybeVersion);
                } catch (InvalidVersionStringException $e) {
                    return null;
                }
            }, explode("\n", $output))
        ));
    }