- Merged stash after pull

This commit is contained in:
mcndave committed 2020-10-16 15:27:54 +00:00
1 parent 114fa5be09
commit efa957fe58
20 files changed
+623 -436

No files matched your search

+17 -2
View File
@@ -2,6 +2,8 @@
namespace Ulmus\Common;
use Ulmus\Annotation\Annotation;
use Ulmus\Migration\FieldDefinition;
use Ulmus\Ulmus,
Ulmus\Adapter\AdapterInterface,
Ulmus\Annotation\Property\Field;
@@ -28,8 +30,8 @@ class EntityField
{
$name = $this->entityResolver->searchFieldAnnotation($this->name, new Field() )->name ?? $this->name;
$name = ( $this->entityResolver->databaseAdapter() ?? Ulmus::$defaultAdapter )->adapter()->escapeIdentifier($name, AdapterInterface::IDENTIFIER_FIELD);
$name = $this->entityResolver->databaseAdapter()->adapter()->escapeIdentifier($name, AdapterInterface::IDENTIFIER_FIELD);
return $useAlias ? "{$this->alias}.$name" : $name;
}
@@ -47,6 +49,19 @@ class EntityField
return false;
}
public static function generateCreateColumn($field) : string
{
$definition = new FieldDefinition($field);
# column_name data_type(length) [NOT NULL] [DEFAULT value] [AUTO_INCREMENT] column_constraint;
return implode(" ", [
$definition->getSqlName(),
$definition->getSqlType(),
]);
}
public static function isObjectType($type) : bool
{
# @ Should be fixed with isBuiltIn() instead, it won't be correct based only on name