- WIP on SQLite Adapter and migration
This commit is contained in:
1 parent
cee978ecfd
commit
9514a46ae7
14 files changed
+98
-40
No files matched your search
@@ -9,7 +9,7 @@ class Relation {
|
||||
public function __construct(
|
||||
public Relation\RelationTypeEnum|string $type,
|
||||
public \Stringable|string|array $key = "",
|
||||
public null|\Closure $generateKey = null,
|
||||
public null|\Closure|array $generateKey = null,
|
||||
public null|\Stringable|string|array $foreignKey = null,
|
||||
public null|\Stringable|string|array $foreignField = null,
|
||||
public array $foreignKeys = [],
|
||||
@@ -20,7 +20,7 @@ class Relation {
|
||||
public null|\Stringable|string|array $field = null,
|
||||
public null|string $entity = null,
|
||||
public null|string $join = null,
|
||||
public string $function = "loadAll",
|
||||
public null|string $function = null,
|
||||
) {
|
||||
$this->key = Attribute::handleArrayField($this->key);
|
||||
$this->foreignKey = Attribute::handleArrayField($this->foreignKey);
|
||||
@@ -54,17 +54,17 @@ class Relation {
|
||||
|
||||
public function isOneToOne() : bool
|
||||
{
|
||||
return $this->type === Relation\RelationTypeEnum::oneToOne || $this->normalizeType() === 'onetoone';
|
||||
return $this->type instanceof Relation\RelationTypeEnum ? $this->type === Relation\RelationTypeEnum::oneToOne : $this->normalizeType() === 'onetoone';
|
||||
}
|
||||
|
||||
public function isOneToMany() : bool
|
||||
{
|
||||
return $this->type === Relation\RelationTypeEnum::oneToMany || $this->normalizeType() === 'onetomany';
|
||||
return $this->type instanceof Relation\RelationTypeEnum ? $this->type === Relation\RelationTypeEnum::oneToMany : $this->normalizeType() === 'onetomany';
|
||||
}
|
||||
|
||||
public function isManyToMany() : bool
|
||||
{
|
||||
return $this->type === Relation\RelationTypeEnum::manyToMany || $this->normalizeType() === 'manytomany';
|
||||
return $this->type instanceof Relation\RelationTypeEnum ? $this->type === Relation\RelationTypeEnum::manyToMany : $this->normalizeType() === 'manytomany';
|
||||
}
|
||||
|
||||
public function function() : string
|
||||
@@ -73,7 +73,7 @@ class Relation {
|
||||
return $this->function;
|
||||
}
|
||||
elseif ($this->isOneToOne()) {
|
||||
return 'load';
|
||||
return 'loadOne';
|
||||
}
|
||||
|
||||
return 'loadAll';
|
||||
|
||||
Reference in new issue
Block a user