- Work done on Join and using the @Relation annotation in case there is no join.

- Added some field type (date, Datetime, Time)
- Added a new @Filter annotation which allows to filter repository from relation into a method.
This commit is contained in:
mcndave committed 2021-01-26 16:48:40 +00:00
1 parent 65de1dd849
commit e465ecdf32
17 files changed
+197 -61

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ class Field implements \Ulmus\Annotation\Annotation {
public array $attributes = [];
public bool $nullable = false;
public bool $nullable;
public function __construct(? string $type = null, ? int $length = null)
{
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class Date extends \Ulmus\Annotation\Property\Field {
public function __construct(? string $type = "date", ? int $length = null)
{
parent::__construct($type, $length);
}
}
@@ -0,0 +1,11 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class Datetime extends \Ulmus\Annotation\Property\Field {
public function __construct(? string $type = "datetime", ? int $length = null)
{
parent::__construct($type, $length);
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class Time extends \Ulmus\Annotation\Property\Field {
public function __construct(? string $type = "time", ? int $length = null)
{
parent::__construct($type, $length);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace Ulmus\Annotation\Property;
class Filter implements \Ulmus\Annotation\Annotation {
public string $method;
public function __construct(string $method = null)
{
if ( $method !== null ) {
$this->method = $method;
}
}
}
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Ulmus\Annotation\Property;
class Having extends Where {}
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Ulmus\Annotation\Property;
class On extends Where {}
+8 -1
View File
@@ -19,7 +19,9 @@ class Relation implements \Ulmus\Annotation\Annotation {
public /*stringable*/ $bridgeForeignKey;
public string $entity;
public string $join;
public string $function = "loadAll";
public function __construct(string $type = null)
@@ -44,4 +46,9 @@ class Relation implements \Ulmus\Annotation\Annotation {
return new $e();
}
public function normalizeType() : string
{
return strtolower(str_replace(['-', '_', ' '], '', $this->type));
}
}
+2 -2
View File
@@ -6,13 +6,13 @@ use Ulmus\Query;
class Where implements \Ulmus\Annotation\Annotation {
public string $field;
public /* stringable */ $field;
public $value;
public string $operator;
public function __construct(? string $field = null, $value = null, ? string $operator = null)
public function __construct(/* stringable */ $field = null, $value = null, ? string $operator = null)
{
if ( $field !== null ) {
$this->field = $field;