@@ 124-135 (lines=12) @@ | ||
121 | * |
|
122 | * @return ModelCollectionInterface |
|
123 | */ |
|
124 | public function removeModel(ModelInterface $model): ModelCollectionInterface |
|
125 | { |
|
126 | $this->resolveModels(); |
|
127 | ||
128 | if (isset($this->models[$model->getId()])) { |
|
129 | $this->propertyReflection->setValue($model, null); |
|
130 | ||
131 | unset($this->models[$model->getId()]); |
|
132 | } |
|
133 | ||
134 | return $this; |
|
135 | } |
|
136 | ||
137 | /** |
|
138 | * @param ModelInterface[]|array $models |
@@ 72-79 (lines=8) @@ | ||
69 | * |
|
70 | * @return ModelCollectionInterface |
|
71 | */ |
|
72 | public function addModel(ModelInterface $model): ModelCollectionInterface |
|
73 | { |
|
74 | $this->propertyReflection->setValue($model, $this->foreignId); |
|
75 | ||
76 | $this->models[$model->getId()] = $model; |
|
77 | ||
78 | return $this; |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @param ModelInterface $model |
|
@@ 86-95 (lines=10) @@ | ||
83 | * |
|
84 | * @return ModelCollectionInterface |
|
85 | */ |
|
86 | public function removeModel(ModelInterface $model): ModelCollectionInterface |
|
87 | { |
|
88 | if (isset($this->models[$model->getId()])) { |
|
89 | $this->propertyReflection->setValue($model, null); |
|
90 | ||
91 | unset($this->models[$model->getId()]); |
|
92 | } |
|
93 | ||
94 | return $this; |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * @param ModelInterface[]|array $models |