Skip to content

Commit

Permalink
Merge 4f783a6 into 2d13bcc
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Mar 8, 2019
2 parents 2d13bcc + 4f783a6 commit 754c331
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.4.x-dev"
}
}
}
9 changes: 9 additions & 0 deletions src/FluidColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,13 @@ private function getOptions(): FluidColumnOptions
{
return new FluidColumnOptions($this->fluidTable, $this->column, $this->namingStrategy);
}

/**
* Returns the underlying DBAL column.
* @return Column
*/
public function getDbalColumn(): Column
{
return $this->column;
}
}
9 changes: 9 additions & 0 deletions src/FluidTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,13 @@ public function extends(string $tableName): FluidTable
$this->column($pk->getName())->references($tableName)->primaryKey();
return $this;
}

/**
* Returns the underlying DBAL table.
* @return Table
*/
public function getDbalTable(): Table
{
return $this->table;
}
}
5 changes: 5 additions & 0 deletions tests/FluidColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function testTypes()
$column->datetimeTzImmutable();
$this->assertSame(Type::getType(Type::DATETIMETZ_IMMUTABLE), $dbalColumn->getType());

$column->time();
$this->assertSame(Type::getType(Type::TIME), $dbalColumn->getType());

$column->timeImmutable();
$this->assertSame(Type::getType(Type::TIME_IMMUTABLE), $dbalColumn->getType());

Expand All @@ -106,6 +109,8 @@ public function testTypes()
$column->json();
$this->assertSame(Type::getType(Type::JSON), $dbalColumn->getType());
}

$this->assertSame('foo', $column->getDbalColumn()->getName());
}

public function testReference()
Expand Down
8 changes: 8 additions & 0 deletions tests/FluidSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ public function testJunctionTable()
$this->assertNotNull($schema->getTable('users_roles')->getColumn('user_id'));
$this->assertNotNull($schema->getTable('users_roles')->getColumn('role_id'));
}

public function testGetDbalSchema()
{
$schema = new Schema();
$fluid = new FluidSchema($schema);

$this->assertSame($schema, $fluid->getDbalSchema());
}
}
5 changes: 3 additions & 2 deletions tests/FluidTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ public function testInherits()
$this->assertSame(['id'], $fk->getLocalColumns());
}

public function testGetDbalSchema()
public function testGetDbalTable()
{
$schema = new Schema();
$fluid = new FluidSchema($schema);

$this->assertSame($schema, $fluid->getDbalSchema());
$contacts = $fluid->table('contacts');
$this->assertSame('contacts', $contacts->getDbalTable()->getName());
}
}

0 comments on commit 754c331

Please sign in to comment.