- First draft of current WIP

This commit is contained in:
mcndave committed 2019-08-21 16:13:00 -04:00
commit b73d046e0a
47 files changed
+2797

No files matched your search

@@ -0,0 +1,13 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class CreatedAt extends \Ulmus\Annotation\Property\Field {
public function __construct()
{
$this->nullable = false;
$this->type = "timestamp";
$this->attributes['default'] = "CURRENT_TIMESTAMP";
}
}
@@ -0,0 +1,19 @@
<?php
namespace Ulmus\Annotation\Property\Field;
/**
* Since we need consistancy between the declaration of our ID and FK fields, it
* was decided to extend the Id class instead of Field for this case.
*/
class ForeignKey extends Id {
public function __construct()
{
parent::__construct();
unset($this->nullable);
$this->attributes['primary_key'] = false;
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class Id extends \Ulmus\Annotation\Property\Field {
public function __construct()
{
$this->nullable = false;
$this->type = "int";
$this->attributes['unsigned'] = true;
$this->attributes['primary_key'] = true;
}
}
@@ -0,0 +1,14 @@
<?php
namespace Ulmus\Annotation\Property\Field;
class UpdatedAt extends \Ulmus\Annotation\Property\Field {
public function __construct()
{
$this->nullable = true;
$this->type = "timestamp";
$this->attributes['update'] = "CURRENT_TIMESTAMP";
$this->attributes['default'] = null;
}
}