for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @file
*/
namespace CultuurNet\UDB3\Offer\ReadModel\Permission\Doctrine;
use CultuurNet\UDB3\Doctrine\DBAL\SchemaConfiguratorInterface;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use ValueObjects\String\String as StringLiteral;
class SchemaConfigurator implements SchemaConfiguratorInterface
{
* @var StringLiteral
protected $tableName;
* @param StringLiteral $tableName
* @param StringLiteral $idField
public function __construct(StringLiteral $tableName, StringLiteral $idField)
$this->tableName = $tableName;
$this->idField = $idField;
idField
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* @inheritdoc
public function configure(AbstractSchemaManager $schemaManager)
$schema = $schemaManager->createSchema();
$table = $schema->createTable($this->tableName->toNative());
$table->addColumn(
$this->idField->toNative(),
'guid',
array('length' => 36, 'notnull' => true)
);
'user_id',
$table->setPrimaryKey([$this->idField->toNative(), 'user_id']);
$schemaManager->createTable($table);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: