diff --git a/src/Adapter/MsSQL.php b/src/Adapter/MsSQL.php index 40055fa..7e1ae5f 100644 --- a/src/Adapter/MsSQL.php +++ b/src/Adapter/MsSQL.php @@ -230,6 +230,6 @@ class MsSQL implements AdapterInterface, MigrateInterface, SqlAdapterInterface { public function queryBuilderClass() : string { - return QueryBuilder\SqlQueryBuilder\MssqlQueryBuilder::class; + return QueryBuilder\Sql\MssqlQueryBuilder::class; } } diff --git a/src/Attribute/Property/Join.php b/src/Attribute/Property/Join.php index d6e1ddd..9bc8ae5 100644 --- a/src/Attribute/Property/Join.php +++ b/src/Attribute/Property/Join.php @@ -9,7 +9,7 @@ class Join { public function __construct( public string $type, public null|string|\Stringable|array $key = null, - public null|string|\Stringable $foreignKey = null, + public null|string|\Stringable|array $foreignKey = null, public null|string $entity = null, public null|string $alias = null, ) { diff --git a/src/Attribute/Property/OrWhere.php b/src/Attribute/Property/OrWhere.php index 6ed3954..568eb9b 100644 --- a/src/Attribute/Property/OrWhere.php +++ b/src/Attribute/Property/OrWhere.php @@ -10,10 +10,11 @@ class OrWhere extends Where { public function __construct( public string|\Stringable|array $field, public mixed $value = null, - public null|string $operator = null, - public null|string $condition = Query\Where::CONDITION_OR, + public string $operator = Query\Where::OPERATOR_EQUAL, + public string $condition = Query\Where::CONDITION_OR, + public string|\Stringable|array|null $fieldValue = null, + public null|array $generateValue = null, ) { - - $this->key = Attribute::handleArrayField($this->key); + parent::__construct($field, $value, $operator, $condition, $fieldValue, $generateValue); } } \ No newline at end of file diff --git a/src/Common/EntityResolver.php b/src/Common/EntityResolver.php index 7c792b5..d0bdf8e 100644 --- a/src/Common/EntityResolver.php +++ b/src/Common/EntityResolver.php @@ -248,7 +248,7 @@ class EntityResolver { protected function getTableAttribute() { - return $this->getAnnotationFromClassname(Attribute\Obj\Table::class, false) ?: $this->getAnnotationFromClassname( Table::class, false ); + return $this->getAttributeImplementing(Attribute\Obj\Table::class) ?: $this->getAnnotationFromClassname( Table::class, false ); } /** diff --git a/src/EntityCollection.php b/src/EntityCollection.php index 020744a..b4074b3 100644 --- a/src/EntityCollection.php +++ b/src/EntityCollection.php @@ -8,7 +8,7 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable { public ? string $entityClass = null; - public static function instance(array $data, null|string $entityClass = null) : self + public static function instance(array $data = [], null|string $entityClass = null) : self { $instance = new static($data); $instance->entityClass = $entityClass; @@ -326,6 +326,16 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable { return $list; } + public function toFilteredArray(Callable $callback) : array { + $list = []; + + foreach($this as $entity) { + $list[] = $callback($entity); + } + + return $list; + } + public function toJsonArray(bool $includeRelations = false) : array { $list = []; @@ -336,7 +346,6 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable { return $list; } - public function fromArray(array $datasets, ? string /*stringable*/ $entityClass = null) : self { foreach($datasets as $dataset) {