|
@@ -96,7 +96,7 @@ discard block |
|
|
block discarded – undo |
|
96
|
96
|
$value = $this->entity->wrap($this->relations, $value); |
|
97
|
97
|
$this->dataSource->save($value); |
|
98
|
98
|
$visibilityOverride->write($value); |
|
99
|
|
- $this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations); |
|
|
99
|
+ $this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations); |
|
100
|
100
|
} |
|
101
|
101
|
|
|
102
|
102
|
private function removeRelations($obj) { // Prevent saving ManyMany twice |
|
@@ -107,10 +107,10 @@ discard block |
|
|
block discarded – undo |
|
107
|
107
|
|
|
108
|
108
|
public function offsetExists($offset) { |
|
109
|
109
|
if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey()); |
|
110
|
|
- if (!empty($this->settings['filter'])) { |
|
111
|
|
- $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
112
|
|
- return isset($data[0]); |
|
113
|
|
- } |
|
|
110
|
+ if (!empty($this->settings['filter'])) { |
|
|
111
|
+ $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
|
112
|
+ return isset($data[0]); |
|
|
113
|
+ } |
|
114
|
114
|
return (bool) $this->dataSource->findById($offset); |
|
115
|
115
|
} |
|
116
|
116
|
|
|
@@ -120,10 +120,10 @@ discard block |
|
|
block discarded – undo |
|
120
|
120
|
|
|
121
|
121
|
public function offsetGet($offset) { |
|
122
|
122
|
if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey()); |
|
123
|
|
- if (!empty($this->settings['filter'])) { |
|
124
|
|
- $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
125
|
|
- return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations); |
|
126
|
|
- } |
|
|
123
|
+ if (!empty($this->settings['filter'])) { |
|
|
124
|
+ $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
|
125
|
+ return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations); |
|
|
126
|
+ } |
|
127
|
127
|
return $this->entity->create($this->dataSource->findById($offset), $this->relations); |
|
128
|
128
|
} |
|
129
|
129
|
|