Dumplie\Metadata\Infrastructure\Doctrine\Dbal\TypeRegistry::withDefaultTypes PHP Method

withDefaultTypes() public static method

public static withDefaultTypes ( ) : TypeRegistry
return TypeRegistry
    public static function withDefaultTypes() : TypeRegistry
    {
        $registry = new static();
        $registry->register(new AssociationMapping());
        $registry->register(new TextMapping());
        $registry->register(new BoolMapping());
        $registry->register(new DateTimeMapping());
        $registry->register(new DecimalMapping());
        $registry->register(new FloatMapping());
        $registry->register(new IntegerMapping());
        $registry->register(new MapMapping());
        return $registry;
    }

Usage Example

 public function setUp()
 {
     $this->connection = DriverManager::getConnection(json_decode(DUMPLIE_TEST_DB_CONNECTION, true));
     if ($this->connection->getSchemaManager()->tablesExist('metadata_test_bar')) {
         $this->connection->getSchemaManager()->dropTable('metadata_test_bar');
     }
     if ($this->connection->getSchemaManager()->tablesExist('metadata_test_foo')) {
         $this->connection->getSchemaManager()->dropTable('metadata_test_foo');
     }
     $foo = new TypeSchema('foo', ['id' => new TextField(), 'text' => new TextField(null, false, ['index' => true])]);
     $bar = new TypeSchema('bar', ['id' => new TextField(), 'link' => new AssociationField('test', $foo)]);
     $this->schema = new Schema('test');
     $this->schema->add($foo);
     $this->schema->add($bar);
     $this->storage = new DoctrineStorage($this->connection, TypeRegistry::withDefaultTypes());
 }
All Usage Examples Of Dumplie\Metadata\Infrastructure\Doctrine\Dbal\TypeRegistry::withDefaultTypes