Code Duplication    Length = 22-22 lines in 2 locations

src/query/Generic.php 1 location

@@ 227-248 (lines=22) @@
224
     *
225
     * @return \samsoncms\api\Entity[] Collection of found entities
226
     */
227
    public function find()
228
    {
229
        $this->query->entity(static::$identifier);
230
231
        // Set entity primary keys if predefined
232
        if (count($this->entityIDs)) {
233
            $this->primary($this->entityIDs);
234
        }
235
236
        // Add query sorter for showed page
237
        if (count($this->orderBy) === 2) {
238
            $this->query->orderBy($this->orderBy[0], $this->orderBy[1]);
239
        }
240
241
        // Proxy to regular database query
242
        $return = $this->query
243
            ->whereCondition($this->conditions)
244
            ->exec();
245
246
        // Reorder if entity identifiers collection was defined
247
        return $this->sortArrayByArray($return, $this->entityIDs);
248
    }
249
250
    /**
251
     * Perform SamsonCMS query and get collection of entities fields.

src/query/Record.php 1 location

@@ 144-165 (lines=22) @@
141
     *
142
     * @return \samsoncms\api\Entity[] Collection of found entities
143
     */
144
    public function find()
145
    {
146
        $this->query->entity(static::$identifier);
147
148
        // Set entity primary keys if predefined
149
        if (count($this->entityIDs)) {
150
            $this->primary($this->entityIDs);
151
        }
152
153
        // Add query sorter for showed page
154
        if (count($this->orderBy) === 2) {
155
            $this->query->orderBy($this->orderBy[0], $this->orderBy[1]);
156
        }
157
158
        // Proxy to regular database query
159
        $return = $this->query
160
            ->whereCondition($this->conditions)
161
            ->exec();
162
163
        // Reorder if entity identifiers collection was defined
164
        return $this->sortArrayByArray($return, $this->entityIDs);
165
    }
166
167
    /**
168
     * Perform SamsonCMS query and get collection of entities fields.