Наследование: extends Storm\Drivers\Base\Relational\Columns\ColumnTrait
Пример #1
0
 protected final function Initialize()
 {
     $this->Register(Mysql\Columns\CharacterSet::GetType(), [$this, 'AppendCharacterSet']);
     $this->Register(Mysql\Columns\Collation::GetType(), [$this, 'AppendCollation']);
     $this->Register(Traits\Comment::GetType(), [$this, 'AppendComment']);
     $this->Register(Traits\DefaultValue::GetType(), [$this, 'AppendDefaultValue']);
     $this->Register(Traits\Increment::GetType(), [$this, 'AppendIncrement']);
     $this->Register(Traits\NotNullable::GetType(), [$this, 'AppendNotNullable']);
 }
Пример #2
0
 public function __construct(array $Columns)
 {
     if (count($Columns) === 0) {
         throw new \Storm\Core\Relational\RelationalException('A primary key must contain atleast one column');
     }
     $this->Columns = array_values($Columns);
     foreach ($this->Columns as $Column) {
         if (!$Column->HasTrait(NotNullable::GetType())) {
             $Column->AddTrait(new NotNullable());
         }
     }
     $this->ColumnNames = array_map(function ($Column) {
         return $Column->GetName();
     }, $this->Columns);
 }