WIP on docs and added basic enums supports
This commit is contained in:
1 parent
497fe5547b
commit
b6752f4364
22 files changed
+367
-35
No files matched your search
@@ -27,7 +27,16 @@ class ObjectInstanciator {
|
||||
|
||||
return (string) $obj;
|
||||
}
|
||||
|
||||
|
||||
public function enum(\UnitEnum $obj)
|
||||
{
|
||||
if (! $obj instanceof \BackedEnum) {
|
||||
throw new \Ulmus\Exception\BackedEnumRequired("Unable to extract a UnitEnum value from this variable. You must define your enum as a BackedEnum instead of an UnitEnum.");
|
||||
}
|
||||
|
||||
return $obj->value;
|
||||
}
|
||||
|
||||
public function registerObject(string $type, Callable $callback) : void
|
||||
{
|
||||
$this->objectCallbackDefinition[$type] = $callback;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Entity\Sqlite;
|
||||
|
||||
use Ulmus\EntityCollection;
|
||||
|
||||
/**
|
||||
* @Table
|
||||
*/
|
||||
class Column
|
||||
{
|
||||
use \Ulmus\EntityTrait;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
*/
|
||||
public int $cid;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $type;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @Virtual
|
||||
*/
|
||||
public string $tableName;
|
||||
|
||||
/**
|
||||
* @Field('name' => "notnull")
|
||||
*/
|
||||
public bool $notNull;
|
||||
|
||||
/**
|
||||
* @Field('name' => 'dflt_value')
|
||||
*/
|
||||
public ? string $defaultValue;
|
||||
|
||||
/**
|
||||
* @Field('name' => "pk")
|
||||
*/
|
||||
public bool $primaryKey;
|
||||
}
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace Ulmus\Entity\Sqlite;
|
||||
|
||||
use Ulmus\ConnectionAdapter;
|
||||
use Ulmus\Repository;
|
||||
|
||||
class Table extends Schema
|
||||
{
|
||||
public static function repository(string $alias = Repository::DEFAULT_ALIAS): Repository
|
||||
public static function repository(string $alias = Repository::DEFAULT_ALIAS, ConnectionAdapter $adapter = null): Repository
|
||||
{
|
||||
return new class(static::class, $alias) extends Repository\SqliteRepository
|
||||
return new class(static::class, $alias, $adapter) extends Repository\SqliteRepository
|
||||
{
|
||||
public function finalizeQuery(): void
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user