@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | |
105 | 105 | public function offsetExists($offset) { |
106 | 106 | if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey()); |
107 | - if (!empty($this->settings['filter'])) { |
|
108 | - $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
109 | - return isset($data[0]); |
|
110 | - } |
|
107 | + if (!empty($this->settings['filter'])) { |
|
108 | + $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
109 | + return isset($data[0]); |
|
110 | + } |
|
111 | 111 | return (bool) $this->dataSource->findById($offset); |
112 | 112 | } |
113 | 113 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | |
118 | 118 | public function offsetGet($offset) { |
119 | 119 | if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey()); |
120 | - if (!empty($this->settings['filter'])) { |
|
121 | - $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
122 | - return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations); |
|
123 | - } |
|
120 | + if (!empty($this->settings['filter'])) { |
|
121 | + $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset])); |
|
122 | + return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations); |
|
123 | + } |
|
124 | 124 | return $this->entity->create($this->dataSource->findById($offset), $this->relations); |
125 | 125 | } |
126 | 126 |