| 1 | <?php |
||
| 10 | class Associated extends RecordCollection |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var Relation |
||
| 15 | */ |
||
| 16 | protected $_withRelation; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var Record |
||
| 20 | */ |
||
| 21 | protected $_item; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param HasCollectionResults $relation |
||
|
|
|||
| 25 | */ |
||
| 26 | 1 | public function initFromRelation($relation) |
|
| 27 | { |
||
| 28 | 1 | $this->setWithRelation($relation); |
|
| 29 | 1 | $this->setManager($relation->getWith()); |
|
| 30 | 1 | $this->setItem($relation->getItem()); |
|
| 31 | 1 | $indexKey = $relation->getParam('indexKey'); |
|
| 32 | 1 | if ($indexKey) { |
|
| 33 | $this->setIndexKey($indexKey); |
||
| 34 | } |
||
| 35 | 1 | } |
|
| 36 | |||
| 37 | public function save() |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return Relation |
||
| 44 | */ |
||
| 45 | public function getWithRelation() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param Relation $relation |
||
| 52 | */ |
||
| 53 | 1 | public function setWithRelation($relation) |
|
| 54 | { |
||
| 55 | 1 | $this->_withRelation = $relation; |
|
| 56 | 1 | } |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @return Record |
||
| 60 | */ |
||
| 61 | public function getItem() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param Record $item |
||
| 68 | */ |
||
| 69 | 1 | public function setItem($item) |
|
| 73 | } |
||
| 74 |