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/Queries/Mysql/Select.php 2 locations

@@ 135-137 (lines=3) @@
132
    {
133
        $scheme = $this->table->getScheme();
134
135
        if (!isset($scheme['relations'][$table])) {
136
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
137
        }
138
139
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
140
            throw new SimpleCrudException(sprintf("Invalid LEFT JOIN between the tables '%s' and '%s'", $this->table->name, $table));
@@ 139-141 (lines=3) @@
136
            throw new SimpleCrudException(sprintf("The tables '%s' and '%s' are not related", $this->table->name, $table));
137
        }
138
139
        if ($scheme['relations'][$table][0] !== Scheme::HAS_ONE) {
140
            throw new SimpleCrudException(sprintf("Invalid LEFT JOIN between the tables '%s' and '%s'", $this->table->name, $table));
141
        }
142
143
        $this->leftJoin[] = [
144
            'table' => $table,

src/Row.php 1 location

@@ 241-243 (lines=3) @@
238
        $relationTable = $row->getTable();
239
        $relations = $table->getScheme()['relations'];
240
241
        if (!isset($relations[$relationTable->name])) {
242
            throw new SimpleCrudException(sprintf('Invalid relation: %s - %s', $table->name, $relationTable->name));
243
        }
244
245
        $relation = $relations[$relationTable->name];
246