Ejemplo n.º 1
0
 /**
  * @expectedException \LiftKit\Database\Schema\Exception\NonexistentTable
  */
 public function testFailsWithNonexistentTable()
 {
     $schema = new Schema($this->connection);
     $childrenTable = $schema->defineTable('children');
     $parentsTable = $schema->defineTable('parents');
     $schema->getTable('nonexistent');
 }
Ejemplo n.º 2
0
 /**
  * @param string      $relatedTable
  * @param string      $relationalTable
  * @param null|string $relatedKey
  * @param null|string $key
  * @param null|string $relationIdentifier
  *
  * @return $this
  * @throws RelationException
  */
 public function manyToMany($relatedTable, $relationalTable, $relatedKey = null, $key = null, $relationIdentifier = null)
 {
     if (is_null($relationIdentifier)) {
         $relationIdentifier = $relatedTable;
     }
     $this->relations[$relationIdentifier] = new ManyToMany($this, $this->schema->getTable($relatedTable, true), $this->schema->getTable($relationalTable, true), $key, $relatedKey);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * @param string $tableName
  *
  * @return Table
  */
 protected function getTable($tableName)
 {
     return $this->schema->getTable($tableName);
 }