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

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

src/Queries/Mysql/Select.php 2 locations

@@ 176-178 (lines=3) @@
173
    {
174
        $scheme = $this->table->getScheme();
175
176
        if (!isset($scheme['relations'][$table])) {
177
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
178
        }
179
180
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
181
            throw new SimpleCrudException(sprintf("Invalid LEFT JOIN between the tables '%s' and '%s'", $this->table->name, $table));
@@ 180-182 (lines=3) @@
177
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
178
        }
179
180
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
181
            throw new SimpleCrudException(sprintf("Invalid LEFT JOIN between the tables '%s' and '%s'", $this->table->name, $table));
182
        }
183
184
        $this->leftJoin[] = [
185
            'table' => $table,