private function setSlugWhenEmpty(NodeTranslation $nodeTranslation, EntityManager $em) { $publicNode = $nodeTranslation->getRef($em); /** Do nothing for StructureNode objects, skip */ if ($publicNode instanceof HasNodeInterface && $publicNode->isStructureNode()) { return; } /** * If no slug is set and no structure node, apply title as slug */ if ($nodeTranslation->getSlug() === null && $nodeTranslation->getNode()->getParent() !== null) { $nodeTranslation->setSlug($this->slugifier->slugify($nodeTranslation->getTitle())); } }
/** * @param NodeTranslation $nodeTranslation * * @return null|object */ public function getPageByNodeTranslation(NodeTranslation $nodeTranslation) { return $nodeTranslation->getRef($this->em); }