1 | <?php |
||
11 | class Entity implements EntityInterface |
||
12 | { |
||
13 | use LoggingEntity; |
||
14 | use EntityManagerAwareEntity; |
||
15 | |||
16 | /** |
||
17 | * @var \eZ\Publish\API\Repository\Repository $repository |
||
18 | */ |
||
19 | protected $repository; |
||
20 | /** |
||
21 | * @var \eZ\Publish\API\Repository\Values\Content\Location $location |
||
22 | */ |
||
23 | protected $location; |
||
24 | /** |
||
25 | * @var \eZ\Publish\API\Repository\Values\Content\Content $content |
||
26 | */ |
||
27 | protected $content; |
||
28 | |||
29 | protected $settings; |
||
30 | |||
31 | /** |
||
32 | * @param eZRepository $repository |
||
33 | * @param Content $content |
||
34 | * @param Location $location |
||
35 | * @param array $settings used to pass to the Entity instance anything that would be done via DIC if it was a service |
||
36 | * @throws \InvalidArgumentException |
||
37 | */ |
||
38 | 10 | public function __construct(eZRepository $repository, Content $content=null, Location $location=null, array $settings = array()) |
|
52 | |||
53 | /** |
||
54 | * Called from the constructor, with the settings received from the caller. |
||
55 | * Subclasses can implement checking here, or merge the received settings with other data, using f.e. the Symfony |
||
56 | * OptionsResolver component (see http://symfony.com/doc/current/components/options_resolver.html). |
||
57 | * |
||
58 | * @param array $settings |
||
59 | * @return array |
||
60 | */ |
||
61 | 10 | protected function validateSettings(array $settings) |
|
65 | |||
66 | /** |
||
67 | * Return the content of the current location |
||
68 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
69 | */ |
||
70 | 9 | public function content() |
|
77 | |||
78 | /** |
||
79 | * NB: if entity has been created from a Content, returns its MAIN location. Otherwise, the Location set at creation |
||
80 | * @return \eZ\Publish\API\Repository\Values\Content\Location |
||
81 | */ |
||
82 | 5 | public function location() |
|
89 | } |
||
90 |