| @@ 12-50 (lines=39) @@ | ||
| 9 | use Doctrine\DBAL\Schema\AbstractSchemaManager; |
|
| 10 | use ValueObjects\String\String as StringLiteral; |
|
| 11 | ||
| 12 | class SchemaConfigurator implements SchemaConfiguratorInterface |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @var StringLiteral |
|
| 16 | */ |
|
| 17 | protected $tableName; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @param StringLiteral $tableName |
|
| 21 | */ |
|
| 22 | public function __construct(StringLiteral $tableName) |
|
| 23 | { |
|
| 24 | $this->tableName = $tableName; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @inheritdoc |
|
| 29 | */ |
|
| 30 | public function configure(AbstractSchemaManager $schemaManager) |
|
| 31 | { |
|
| 32 | $schema = $schemaManager->createSchema(); |
|
| 33 | $table = $schema->createTable($this->tableName->toNative()); |
|
| 34 | ||
| 35 | $table->addColumn( |
|
| 36 | 'event_id', |
|
| 37 | 'guid', |
|
| 38 | array('length' => 36, 'notnull' => true) |
|
| 39 | ); |
|
| 40 | $table->addColumn( |
|
| 41 | 'user_id', |
|
| 42 | 'guid', |
|
| 43 | array('length' => 36, 'notnull' => true) |
|
| 44 | ); |
|
| 45 | ||
| 46 | $table->setPrimaryKey(['event_id', 'user_id']); |
|
| 47 | ||
| 48 | $schemaManager->createTable($table); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 12-50 (lines=39) @@ | ||
| 9 | use Doctrine\DBAL\Schema\AbstractSchemaManager; |
|
| 10 | use ValueObjects\String\String as StringLiteral; |
|
| 11 | ||
| 12 | class SchemaConfigurator implements SchemaConfiguratorInterface |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @var StringLiteral |
|
| 16 | */ |
|
| 17 | protected $tableName; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @param StringLiteral $tableName |
|
| 21 | */ |
|
| 22 | public function __construct(StringLiteral $tableName) |
|
| 23 | { |
|
| 24 | $this->tableName = $tableName; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @inheritdoc |
|
| 29 | */ |
|
| 30 | public function configure(AbstractSchemaManager $schemaManager) |
|
| 31 | { |
|
| 32 | $schema = $schemaManager->createSchema(); |
|
| 33 | $table = $schema->createTable($this->tableName->toNative()); |
|
| 34 | ||
| 35 | $table->addColumn( |
|
| 36 | 'place_id', |
|
| 37 | 'guid', |
|
| 38 | array('length' => 36, 'notnull' => true) |
|
| 39 | ); |
|
| 40 | $table->addColumn( |
|
| 41 | 'user_id', |
|
| 42 | 'guid', |
|
| 43 | array('length' => 36, 'notnull' => true) |
|
| 44 | ); |
|
| 45 | ||
| 46 | $table->setPrimaryKey(['place_id', 'user_id']); |
|
| 47 | ||
| 48 | $schemaManager->createTable($table); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||