Ejemplo n.º 1
0
 /**
  * @param string $constraintName
  * @return ForeignKeyConstraint
  */
 public function getForeignKey($constraintName)
 {
     $constraintName = strtolower($constraintName);
     if (!$this->hasForeignKey($constraintName)) {
         throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
     }
     return $this->_fkConstraints[$constraintName];
 }
Ejemplo n.º 2
0
 /**
  * Removes the foreign key constraint with the given name.
  *
  * @param string $constraintName The constraint name.
  *
  * @return void
  *
  * @throws \Doctrine\DBAL\Schema\SchemaException
  */
 public function removeForeignKey($constraintName)
 {
     $constraintName = strtolower($constraintName);
     if (!$this->hasForeignKey($constraintName)) {
         throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
     }
     unset($this->_fkConstraints[$constraintName]);
 }