- Added a new MsSQL adapter

- Some bugfixes were made within annotations.
- Added a new Object Instanciator which allows to manipulate and define how an object from an entity must be instanciated with given value.
This commit is contained in:
Dave Mc Nicoll committed 2020-01-29 16:11:16 -05:00
1 parent 9df7e65dcf
commit 5bd60129ea
22 files changed
+547 -103

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ class AnnotationReader
try {
$tags[] = [
'tag' => substr($line, 0, $open - 1),
'arguments' => eval("namespace $namespace; return [ $arguments ];"),
'arguments' => eval("namespace $namespace; return [ $arguments ];" ),
];
}
catch(\Throwable $error) {
+2
View File
@@ -6,6 +6,8 @@ class Table implements \Ulmus\Annotation\Annotation {
public string $name;
public string $schema;
public function __construct($name = null)
{
if ( $name !== null ) {
+7 -9
View File
@@ -16,16 +16,14 @@ class Field implements \Ulmus\Annotation\Annotation {
public bool $nullable = false;
public function __construct(string $type = null, int $length = null)
public function __construct(? string $type = null, ? int $length = null)
{
switch(true) {
case $type !== null:
$this->type = $type;
break;
case $length !== null:
$this->length = $length;
break;
if ( $type !== null ) {
$this->type = $type;
}
if ( $length !== null ) {
$this->length = $length;
}
}
}
+7 -9
View File
@@ -9,15 +9,13 @@ class OrderBy implements \Ulmus\Annotation\Annotation {
public string $order = "ASC";
public function __construct(string $field = null, string $order = null)
{
switch(true) {
case $field !== null:
$this->field = $field;
break;
case $order !== null:
$this->order = $order;
break;
{
if ( $field !== null ) {
$this->field = $field;
}
if ( $order !== null ) {
$this->order = $order;
}
}
}
+10 -4
View File
@@ -17,13 +17,19 @@ class Relation implements \Ulmus\Annotation\Annotation {
public string $bridgeKey;
public string $bridgeForeignKey;
public string $entity;
public function __construct(string $type = null)
{
switch(true) {
case $type !== null:
$this->type = $type;
break;
if ( $type !== null ) {
$this->type = $type;
}
}
public function entity() {
$e = $this->entity;
return new $e();
}
}
+22 -5
View File
@@ -2,14 +2,31 @@
namespace Ulmus\Annotation\Property;
use Ulmus\Query;
class Where implements \Ulmus\Annotation\Annotation {
public array $comparisons = [];
public function __construct(...$comparisons)
public string $field;
public $value;
public string $operator;
public function __construct(? string $field = null, $value = null, ? string $operator = null)
{
if ( $comparisons ) {
$this->comparisons = $comparisons;
if ( $field !== null ) {
$this->field = $field;
}
if ( $value !== null ) {
$this->value = $value;
}
if ( $operator !== null ) {
$this->operator = $operator;
}
else {
$this->operator = Query\Where::OPERATOR_EQUAL;
}
}
}