vendor/ibexa/core/src/lib/Repository/Values/Content/Location.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace Ibexa\Core\Repository\Values\Content;
  8. use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo as APIContentInfo;
  9. use Ibexa\Contracts\Core\Repository\Values\Content\Location as APILocation;
  10. /**
  11.  * This class represents a location in the repository.
  12.  *
  13.  * @internal Meant for internal use by Repository, type hint against API object instead.
  14.  */
  15. class Location extends APILocation
  16. {
  17.     /**
  18.      * Content info of the content object of this location.
  19.      *
  20.      * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo
  21.      */
  22.     protected $contentInfo;
  23.     /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */
  24.     protected $parentLocation;
  25.     /**
  26.      * Returns the content info of the content object of this location.
  27.      *
  28.      * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo
  29.      */
  30.     public function getContentInfo(): APIContentInfo
  31.     {
  32.         return $this->contentInfo;
  33.     }
  34.     public function getParentLocation(): ?APILocation
  35.     {
  36.         return $this->parentLocation;
  37.     }
  38.     /**
  39.      * Function where list of properties are returned.
  40.      *
  41.      * Override to add dynamic properties
  42.      *
  43.      * @uses \parent::getProperties()
  44.      *
  45.      * @param array $dynamicProperties
  46.      *
  47.      * @return array
  48.      */
  49.     protected function getProperties($dynamicProperties = ['contentId'])
  50.     {
  51.         return parent::getProperties($dynamicProperties);
  52.     }
  53.     /**
  54.      * Magic getter for retrieving convenience properties.
  55.      *
  56.      * @param string $property The name of the property to retrieve
  57.      *
  58.      * @return mixed
  59.      */
  60.     public function __get($property)
  61.     {
  62.         if ($property === 'contentId') {
  63.             return $this->getContentInfo()->getId();
  64.         }
  65.         return parent::__get($property);
  66.     }
  67.     /**
  68.      * Magic isset for signaling existence of convenience properties.
  69.      *
  70.      * @param string $property
  71.      *
  72.      * @return bool
  73.      */
  74.     public function __isset($property)
  75.     {
  76.         if ($property === 'contentId') {
  77.             return true;
  78.         }
  79.         return parent::__isset($property);
  80.     }
  81. }
  82. class_alias(Location::class, 'eZ\Publish\Core\Repository\Values\Content\Location');