- Added a MssqlRepository
- Adapter some code to allow more flexibility for the new LDAP adapter from ulmus-ldap. - Insert's fields are now escaped by default. - A new RelationBuilder was added, a lot of code from the EntityTrait was moved into this. Some code from the Repository class will need to be moved there too.
This commit is contained in:
1 parent
8f9332fbad
commit
16c6eb57fb
32 files changed
+641
-243
No files matched your search
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Field;
|
||||
|
||||
class Bigint extends \Ulmus\Annotation\Property\Field
|
||||
{
|
||||
public function __construct(? string $type = "bigint", ? int $length = null)
|
||||
{
|
||||
parent::__construct($type, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Field;
|
||||
|
||||
class Longtext extends \Ulmus\Annotation\Property\Field
|
||||
{
|
||||
public function __construct(? string $type = "longtext", ? int $length = null)
|
||||
{
|
||||
parent::__construct($type, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Field;
|
||||
|
||||
class Mediumtext extends \Ulmus\Annotation\Property\Field
|
||||
{
|
||||
public function __construct(? string $type = "mediumtext", ? int $length = null)
|
||||
{
|
||||
parent::__construct($type, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Field;
|
||||
|
||||
class Text extends \Ulmus\Annotation\Property\Field
|
||||
{
|
||||
public function __construct(? string $type = "text", ? int $length = null)
|
||||
{
|
||||
parent::__construct($type, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Field;
|
||||
|
||||
class Tinyint extends \Ulmus\Annotation\Property\Field
|
||||
{
|
||||
public function __construct(? string $type = "tinyint", ? int $length = null)
|
||||
{
|
||||
parent::__construct($type, $length);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class Relation implements \Ulmus\Annotation\Annotation {
|
||||
public /*stringable*/ $bridgeKey;
|
||||
|
||||
public /*stringable*/ $bridgeForeignKey;
|
||||
|
||||
|
||||
public string $entity;
|
||||
|
||||
public string $join;
|
||||
@@ -30,20 +30,20 @@ class Relation implements \Ulmus\Annotation\Annotation {
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function entity() {
|
||||
try {
|
||||
$e = $this->entity;
|
||||
$e = $this->entity;
|
||||
} catch (\Throwable $ex) {
|
||||
throw new \Exception("Your @Relation annotation seems to be missing an `entity` entry.");
|
||||
}
|
||||
|
||||
|
||||
return new $e();
|
||||
}
|
||||
|
||||
|
||||
public function bridge() {
|
||||
$e = $this->bridge;
|
||||
|
||||
|
||||
return new $e();
|
||||
}
|
||||
|
||||
@@ -51,4 +51,24 @@ class Relation implements \Ulmus\Annotation\Annotation {
|
||||
{
|
||||
return strtolower(str_replace(['-', '_', ' '], '', $this->type));
|
||||
}
|
||||
|
||||
public function isOneToOne() : bool
|
||||
{
|
||||
return $this->normalizeType() === 'onetoone';
|
||||
}
|
||||
|
||||
public function isOneToMany() : bool
|
||||
{
|
||||
return $this->normalizeType() === 'onetomany';
|
||||
}
|
||||
|
||||
public function isManyToMany() : bool
|
||||
{
|
||||
return $this->normalizeType() === 'manytomany';
|
||||
}
|
||||
|
||||
public function hasBridge() : bool
|
||||
{
|
||||
return isset($this->bridge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property\Relation;
|
||||
|
||||
class Ignore implements \Ulmus\Annotation\Annotation {}
|
||||
@@ -14,7 +14,7 @@ class Where implements \Ulmus\Annotation\Annotation {
|
||||
|
||||
public string $condition;
|
||||
|
||||
public function __construct(? string $field = null, $value = null, ? string $operator = null, ? string $condition = null)
|
||||
public function __construct(/* ? Stringable */ $field = null, $value = null, ? string $operator = null, ? string $condition = null)
|
||||
{
|
||||
if ( $field !== null ) {
|
||||
$this->field = $field;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Annotation\Property;
|
||||
|
||||
class WithJoin implements \Ulmus\Annotation\Annotation {
|
||||
|
||||
protected array $joins;
|
||||
|
||||
public function __construct(/*Stringable|array|null*/ $joins = null)
|
||||
{
|
||||
if ( $joins ) {
|
||||
$this->joins = (array)$joins;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user