schema with beans instead of arrays
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace DatabaseHelper;
|
||||
|
||||
use DatabaseHelper\beans\Schema;
|
||||
use DatabaseHelper\enums\Aggregation;
|
||||
use DatabaseHelper\enums\Join;
|
||||
use DatabaseHelper\enums\Order;
|
||||
use http\Exception\InvalidArgumentException;
|
||||
use SimplePie\Exception;
|
||||
|
||||
class Query
|
||||
{
|
||||
@@ -41,9 +41,9 @@ class Query
|
||||
public function join(Join $join, Schema $other): Query {
|
||||
$foreignKey = null;
|
||||
if($this->schema->existsReference($other))
|
||||
$foreignKey = $this->schema->foreignKeys[$other->name];
|
||||
$foreignKey = $this->schema->references[$other->name];
|
||||
if ($other->existsReference($this->schema))
|
||||
$foreignKey = $other->foreignKeys[$this->schema->name];
|
||||
$foreignKey = $other->references[$this->schema->name];
|
||||
|
||||
if (is_null($foreignKey))
|
||||
throw new InvalidArgumentException('Joins can only applied to referencing columns.');
|
||||
|
Reference in New Issue
Block a user