| 1 | <?php |
||
| 8 | trait LazyPropertiesTrait |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var EntityCollection |
||
| 12 | */ |
||
| 13 | private $delegatesCollection; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @see LazyPropertiesInterface::registerLoader() |
||
| 17 | */ |
||
| 18 | public function registerLoader($field, \Closure $delegate) |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @see LazyPropertiesInterface::registerLoaders() |
||
| 29 | */ |
||
| 30 | public function registerLoaders(array $loaders) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Load given field if able to, define his value and return it. |
||
| 39 | * |
||
| 40 | * @example |
||
| 41 | * public function getRelatedEntity() |
||
| 42 | * { |
||
| 43 | * return $this->load('relatedEntity'); |
||
| 44 | * } |
||
| 45 | * |
||
| 46 | * @param string $field |
||
| 47 | * |
||
| 48 | * @return mixed|null field value if retrieved |
||
| 49 | */ |
||
| 50 | protected function load($field) |
||
| 64 | } |
||
| 65 |