@@ 12-40 (lines=29) @@ | ||
9 | * |
|
10 | * @author Florian Ajir <[email protected]> |
|
11 | */ |
|
12 | class ManyToOneRelation extends AbstractRelation implements RelationInterface |
|
13 | { |
|
14 | /** |
|
15 | * @var array |
|
16 | */ |
|
17 | protected $entity; |
|
18 | ||
19 | /** |
|
20 | * @param array $data |
|
21 | */ |
|
22 | public function __construct(array $data) |
|
23 | { |
|
24 | parent::__construct($data); |
|
25 | $relation = $data[DataTransformer::RELATED_RELATION_KEY]; |
|
26 | $joinColumn = $relation[DataMapper::RELATION_KEY_JOIN_COLUMN]; |
|
27 | $this->joinColumnName = $joinColumn[DataMapper::RELATION_KEY_JOIN_COLUMN_NAME]; |
|
28 | $this->joinColumnReferencedColumnName = |
|
29 | $joinColumn[DataMapper::RELATION_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME]; |
|
30 | $this->entity = $data[DataTransformer::RELATED_DATA_KEY][$this->entityName]; |
|
31 | } |
|
32 | ||
33 | /** |
|
34 | * @return array |
|
35 | */ |
|
36 | public function getEntity() |
|
37 | { |
|
38 | return $this->entity; |
|
39 | } |
|
40 | } |
|
41 |
@@ 12-40 (lines=29) @@ | ||
9 | * |
|
10 | * @author Florian Ajir <[email protected]> |
|
11 | */ |
|
12 | class OneToOneRelation extends AbstractRelation implements RelationInterface |
|
13 | { |
|
14 | /** |
|
15 | * @var array |
|
16 | */ |
|
17 | protected $entity; |
|
18 | ||
19 | /** |
|
20 | * @param array $data |
|
21 | */ |
|
22 | public function __construct(array $data) |
|
23 | { |
|
24 | parent::__construct($data); |
|
25 | $relation = $data[DataTransformer::RELATED_RELATION_KEY]; |
|
26 | $joinColumn = $relation[DataMapper::RELATION_KEY_JOIN_COLUMN]; |
|
27 | $this->joinColumnName = $joinColumn[DataMapper::RELATION_KEY_JOIN_COLUMN_NAME]; |
|
28 | $this->joinColumnReferencedColumnName = |
|
29 | $joinColumn[DataMapper::RELATION_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME]; |
|
30 | $this->entity = $data[DataTransformer::RELATED_DATA_KEY][$this->entityName]; |
|
31 | } |
|
32 | ||
33 | /** |
|
34 | * @return array |
|
35 | */ |
|
36 | public function getEntity() |
|
37 | { |
|
38 | return $this->entity; |
|
39 | } |
|
40 | } |
|
41 |