- Work done on Ulmus which were added within the Bottin de suppléance app

This commit is contained in:
mcndave committed 2021-10-21 19:02:59 +00:00
1 parent 7fb591e1f5
commit 9ad2e94d12
9 files changed
+219 -127

No files matched your search

+3 -2
View File
@@ -6,9 +6,10 @@ use Ulmus\Annotation\Annotation;
use Ulmus\Migration\FieldDefinition;
use Ulmus\Ulmus,
Ulmus\Adapter\AdapterInterface,
Ulmus\Annotation\Property\Field;
Ulmus\Annotation\Property\Field,
Ulmus\Query\WhereRawParameter;
class EntityField
class EntityField implements WhereRawParameter
{
public string $name;
+1 -11
View File
@@ -83,16 +83,6 @@ class EntityResolver {
throw new \InvalidArgumentException("Given `fieldKey` is unknown to the EntityResolver");
}
if ($escape) {
if ( isset($tag['object']->name) ) {
$tag['object']->name = 2;
}
if ( isset($item['name']) ) {
$item['name'] = 2;
}
}
$fieldList[$key] = $item;
break;
@@ -131,7 +121,7 @@ class EntityResolver {
return $found ? $found[0] : null;
}
public function searchFieldAnnotationList(string $field, Annotation $annotationType) : array
public function searchFieldAnnotationList(string $field, Annotation $annotationType) : array
{
$list = [];
+11 -5
View File
@@ -2,11 +2,13 @@
namespace Ulmus\Common;
use Ulmus\Query\WhereRawParameter;
abstract class Sql {
public static function function($name, ...$arguments)
{
return new class($name, ...$arguments) {
return new class($name, ...$arguments) implements WhereRawParameter {
protected string $as = "";
@@ -20,19 +22,23 @@ abstract class Sql {
$this->parseArguments();
}
public function __toString() {
public function __toString() : string
{
return implode(' ', array_filter([
"{$this->name}(" . implode(", ", $this->arguments) . ")",
$this->as ? "AS {$this->as}" : false,
]));
}
public function as($fieldName) {
public function as($fieldName) : self
{
$this->as = $fieldName;
return $this;
}
protected function parseArguments() {
protected function parseArguments() : void
{
foreach($this->arguments as &$item) {
$item = Sql::escape($item);
}
@@ -42,7 +48,7 @@ abstract class Sql {
public static function identifier(string $identifier) : object
{
return new class($identifier) {
return new class($identifier) implements WhereRawParameter {
protected string $identifier;