You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to "move" a new (yes a new) document (Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route) to another node by using setParentDocument in a prePersist event listener.
The target node is created on the fly if it's not there, using NodeHelper::createPath (I only need a generic target node).
publicfunctionprePersist(LifecycleEventArgs$args)
{
$route = $args->getObject();
$dm = $args->getObjectManager();
if ($route instanceof Route) {
$localeNodePath = $this->routeRoot . '/' . $this->locale;
if (!$localeNode = $dm->find(null, $localeNodePath)) {
$session = $dm->getPhpcrSession();
$localeNode = NodeHelper::createPath($session, $localeNodePath);
/* $session->save(); I believe this is not needed? */
}
$route->setParentDocument($localeNode);
}
}
The exception message is Document is not managed and has no id ....
Perhaps this is caused by the fact that the target node is created on the fly, but even calling $session->save doesn't help.
Any insight is greatly appreciated.
The text was updated successfully, but these errors were encountered:
Hello,
I'm trying to "move" a new (yes a new) document (
Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route
) to another node by usingsetParentDocument
in aprePersist
event listener.The target node is created on the fly if it's not there, using
NodeHelper::createPath
(I only need a generic target node).The exception message is
Document is not managed and has no id ....
Perhaps this is caused by the fact that the target node is created on the fly, but even calling
$session->save
doesn't help.Any insight is greatly appreciated.
The text was updated successfully, but these errors were encountered: