untrashLocation() 추상적인 공개 메소드

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
리턴 eZ\Publish\SPI\Persistence\Content\Location
예제 #1
0
 /**
  * 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);
     }
 }
예제 #2
0
 /**
  * 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;
 }