1: <?php
2:
3: namespace PHPixie\ORM\Relationships\Type\Embeds\Side;
4:
5: abstract class Config extends \PHPixie\ORM\Relationships\Relationship\Implementation\Side\Config
6: {
7: public $ownerModel;
8: public $itemModel;
9: public $path;
10:
11: protected function processConfig($config, $inflector)
12: {
13: $itemOptionName = $this->itemOptionName();
14: $itemPropertyName = $this->ownerPropertyName();
15:
16: $this->ownerModel = $config->getRequired('owner');
17: $this->itemModel = $config->getRequired($itemOptionName);
18:
19: $itemProperty = $config->get('ownerOptions.'.$itemOptionName.'Property', null);
20: if ($itemProperty === null)
21: $itemProperty = $this->defaultOwnerProperty($inflector);
22: $this->$itemPropertyName = $itemProperty;
23:
24:
25: $itemOptionsPrefix = $itemOptionName.'Options';
26: $this->path = $config->get($itemOptionsPrefix.'.path', $itemProperty);
27: }
28:
29: public function ownerProperty()
30: {
31: $property = $this->ownerPropertyName();
32: return $this->$property;
33: }
34:
35: abstract protected function itemOptionName();
36: abstract protected function ownerPropertyName();
37: abstract protected function defaultOwnerProperty($inflector);
38: }
39: