/** * Updates parent id of autogenerated entries. * * Update includes history entries. * * @param mixed $oldParentId * @param mixed $newParentId */ public function reparent($oldParentId, $newParentId) { try { $this->innerGateway->reparent($oldParentId, $newParentId); } catch (DBALException $e) { throw new \RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new \RuntimeException('Database error', 0, $e); } }
/** * Notifies the underlying engine that a location has moved. * * This method triggers the change of the autogenerated aliases. * * @param mixed $locationId * @param mixed $oldParentId * @param mixed $newParentId */ public function locationMoved($locationId, $oldParentId, $newParentId) { // @todo optimize: $newLocationAliasId is already available in self::publishUrlAliasForLocation() as $newId $newParentLocationAliasId = $this->getRealAliasId($newParentId); $newLocationAlias = $this->gateway->loadAutogeneratedEntry('eznode:' . $locationId, $newParentLocationAliasId); $oldParentLocationAliasId = $this->getRealAliasId($oldParentId); $oldLocationAlias = $this->gateway->loadAutogeneratedEntry('eznode:' . $locationId, $oldParentLocationAliasId); // Historize alias for old location $this->gateway->historizeId($oldLocationAlias['id'], $newLocationAlias['id']); // Reparent subtree of old location to new location $this->gateway->reparent($oldLocationAlias['id'], $newLocationAlias['id']); }