invalidDefinition() public static method

public static invalidDefinition ( string $expectedClass, Dumplie\Metadata\Schema\FieldDefinition $receivedInstance ) : DoctrineStorageException
$expectedClass string
$receivedInstance Dumplie\Metadata\Schema\FieldDefinition
return DoctrineStorageException
示例#1
0
 /**
  * @param string          $schema
  * @param Table           $table
  * @param string          $name
  * @param FieldDefinition $definition
  *
  * @throws DoctrineStorageException
  */
 public function map(string $schema, Table $table, string $name, FieldDefinition $definition)
 {
     if (!$definition instanceof AssociationFieldDefinition) {
         throw DoctrineStorageException::invalidDefinition(AssociationFieldDefinition::class, $definition);
     }
     $table->addColumn($name, 'guid', ['notnull' => !$definition->isNullable(), 'default' => $definition->defaultValue(), 'length' => $definition->options()['length'] ?? null, 'unique' => $definition->options()['unique'] ?? false]);
     $table->addForeignKeyConstraint($this->tableName($schema, $definition->typeSchema()->name()), [$name], ['id']);
 }