schema with beans instead of arrays

This commit is contained in:
Jan-Niclas Loosen
2025-02-21 19:06:16 +01:00
parent 13fa680b87
commit 024e6e73cb
13 changed files with 123 additions and 140 deletions

View File

@@ -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.');