- WIP on Migration of MsSQL
This commit is contained in:
1 parent
c54de30069
commit
fb4985160a
17 files changed
+252
-175
No files matched your search
@@ -6,6 +6,5 @@ namespace Ulmus\Attribute\Property;
|
||||
class Filter {
|
||||
public function __construct(
|
||||
public string $method = ""
|
||||
)
|
||||
{}
|
||||
) {}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Ulmus\Attribute\Property;
|
||||
|
||||
use Ulmus\Attribute\Attribute;
|
||||
use Ulmus\Repository;
|
||||
|
||||
#[\Attribute]
|
||||
class Join implements ResettablePropertyInterface {
|
||||
@@ -16,4 +17,20 @@ class Join implements ResettablePropertyInterface {
|
||||
$this->key = Attribute::handleArrayField($this->key);
|
||||
$this->foreignKey = Attribute::handleArrayField($this->foreignKey);
|
||||
}
|
||||
|
||||
## AWAITING THE Closures in constant expression from PHP 8.5 !
|
||||
public function foreignKey(? Repository $repository = null) : mixed
|
||||
{
|
||||
if (is_string($this->foreignKey)) {
|
||||
if (str_starts_with($this->foreignKey, 'fn(') && str_contains($this->foreignKey, '=>')) {
|
||||
$closure = eval("return {$this->foreignKey};");
|
||||
|
||||
return $repository ? $closure($repository) : $closure;
|
||||
}
|
||||
|
||||
return $this->entity::field($this->foreignKey, $this->alias);
|
||||
}
|
||||
|
||||
return $this->foreignKey;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Ulmus\Attribute\Property;
|
||||
|
||||
use Ulmus\Attribute\Attribute;
|
||||
use Ulmus\Repository;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Relation implements ResettablePropertyInterface {
|
||||
@@ -21,6 +22,7 @@ class Relation implements ResettablePropertyInterface {
|
||||
public null|string $entity = null,
|
||||
public null|string $join = null,
|
||||
public null|string $function = null,
|
||||
public null|string $alias = null,
|
||||
) {
|
||||
$this->key = Attribute::handleArrayField($this->key);
|
||||
$this->foreignKey = Attribute::handleArrayField($this->foreignKey);
|
||||
@@ -83,4 +85,20 @@ class Relation implements ResettablePropertyInterface {
|
||||
{
|
||||
return (bool) $this->bridge;
|
||||
}
|
||||
|
||||
## AWAITING THE Closures in constant expression from PHP 8.5 !
|
||||
public function foreignKey(? Repository $repository = null) : mixed
|
||||
{
|
||||
if (is_string($this->foreignKey)) {
|
||||
if (str_starts_with($this->foreignKey, 'fn(') && str_contains($this->foreignKey, '=>')) {
|
||||
$closure = eval("return {$this->foreignKey};");
|
||||
|
||||
return $repository ? $closure($repository) : $closure;
|
||||
}
|
||||
|
||||
return $this->entity::field($this->foreignKey, $this->alias);
|
||||
}
|
||||
|
||||
return $this->foreignKey;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user