Recreates the originally trashed location in the new position. If no new
position has been specified, it will be tried to re-create the location
at the old position. If this is not possible ( because the old location
does not exist any more) and exception is thrown.
abstract public untrashLocation ( mixed $locationId, mixed $newParentId = null ) : eZ\Publish\SPI\Persistence\Content\Location | ||
$locationId | mixed | |
$newParentId | mixed | |
Résultat | eZ\Publish\SPI\Persistence\Content\Location |
/** * Returns a trashed location to normal state. * * Recreates the originally trashed location in the new position. If no new * position has been specified, it will be tried to re-create the location * at the old position. If this is not possible ( because the old location * does not exist any more) and exception is thrown. * * @param mixed $locationId * @param mixed $newParentId * * @return \eZ\Publish\SPI\Persistence\Content\Location */ public function untrashLocation($locationId, $newParentId = null) { try { return $this->innerGateway->untrashLocation($locationId, $newParentId); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Returns a trashed location to normal state. * * Recreates the originally trashed location in the new position. * If this is not possible (because the old location does not exist any more), * a ParentNotFound exception is thrown. * * Returns newly restored location Id. * * @param mixed $trashedId * @param mixed $newParentId * * @return int Newly restored location id * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException If $newParentId is invalid * @todo Handle field types actions */ public function recover($trashedId, $newParentId) { return $this->locationGateway->untrashLocation($trashedId, $newParentId)->id; }