| Total Complexity | 7 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 63.16% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 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() |
||
| 38 | { |
||
| 39 | return $this->getWithRelation()->save(); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return Relation |
||
| 44 | */ |
||
| 45 | public function getWithRelation() |
||
| 46 | { |
||
| 47 | return $this->_withRelation; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param Relation $relation |
||
| 52 | */ |
||
| 53 | 1 | public function setWithRelation($relation) |
|
| 56 | 1 | } |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @return Record |
||
| 60 | */ |
||
| 61 | public function getItem() |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param Record $item |
||
| 68 | */ |
||
| 69 | 1 | public function setItem($item) |
|
| 74 |