Code Duplication    Length = 3-3 lines in 4 locations

src/Queries/Mysql/ExtendedSelectionTrait.php 1 location

@@ 61-63 (lines=3) @@
58
        $table = $row->getTable();
59
        $scheme = $this->table->getScheme();
60
61
        if (!isset($scheme['relations'][$table->name])) {
62
            throw new SimpleCrudException(sprintf('The tables %s and %s are no related', $table->name, $this->table->name));
63
        }
64
65
        $relation = $scheme['relations'][$table->name];
66

src/Row.php 1 location

@@ 251-253 (lines=3) @@
248
        $relationTable = $row->getTable();
249
        $relations = $table->getScheme()['relations'];
250
251
        if (!isset($relations[$relationTable->name])) {
252
            throw new SimpleCrudException(sprintf('Invalid relation: %s - %s', $table->name, $relationTable->name));
253
        }
254
255
        $relation = $relations[$relationTable->name];
256

src/Queries/Mysql/Select.php 2 locations

@@ 194-196 (lines=3) @@
191
        $join = strtoupper($join);
192
        $scheme = $this->table->getScheme();
193
194
        if (!isset($scheme['relations'][$table])) {
195
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
196
        }
197
198
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
199
            throw new SimpleCrudException(sprintf("Invalid %s JOIN between the tables '%s' and '%s'", $join, $this->table->name, $table));
@@ 198-200 (lines=3) @@
195
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
196
        }
197
198
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
199
            throw new SimpleCrudException(sprintf("Invalid %s JOIN between the tables '%s' and '%s'", $join, $this->table->name, $table));
200
        }
201
202
        if (!isset($this->join[$join])) {
203
            $this->join[$join] = [];