コード例 #1
0
ファイル: SchemaTest.php プロジェクト: liftkit/database
 /**
  * @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');
 }
コード例 #2
0
ファイル: Table.php プロジェクト: liftkit/database
 /**
  * @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;
 }
コード例 #3
0
ファイル: Model.php プロジェクト: liftkit/database
 /**
  * @param string $tableName
  *
  * @return Table
  */
 protected function getTable($tableName)
 {
     return $this->schema->getTable($tableName);
 }