- WIP on SearchRequest enums and manual searchs

This commit is contained in:
Dave Mc Nicoll committed 2024-06-28 11:46:09 +00:00
1 parent 0c8591f238
commit 62998faf40
6 files changed
+88 -22

No files matched your search

+26
View File
@@ -2,6 +2,7 @@
namespace Ulmus\Entity\Sqlite;
use Notes\Common\ReflectedProperty;
use Ulmus\EntityCollection;
use Ulmus\{Attribute\Obj\Table};
@@ -32,4 +33,29 @@ class Column
#[Field(name: "pk")]
public bool $primaryKey;
public function matchFieldDefinition(ReflectedProperty $definition) : bool
{
if ($this->notNull === $definition->allowsNull()) {
return false;
}
if (isset($definition->value)) {
if ( $definition->value !== $this->defaultValue) {
return false;
}
}
elseif (! isset($definition->value)) {
if ( ! $this->defaultValueIsNull() ) {
return false;
}
}
return true;
}
protected function defaultValueIsNull() : bool
{
return $this->defaultValue === null || $this->defaultValue === "NULL";
}
}