Ejemplo n.º 1
0
 /**
  * @param \Doctrine\DBAL\Schema\Table                $localTable
  * @param \Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey
  *
  * @return \Doctrine\DBAL\Schema\SchemaException
  */
 public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey)
 {
     return new self("The performed schema operation on " . $localTable->getName() . " requires a named foreign key, " . "but the given foreign key from (" . implode(", ", $foreignKey->getColumns()) . ") onto foreign table " . "'" . $foreignKey->getForeignTableName() . "' (" . implode(", ", $foreignKey->getForeignColumns()) . ") is currently " . "unnamed.");
 }
Ejemplo n.º 2
0
 /**
  * @param ForeignKeyConstraint $key1
  * @param ForeignKeyConstraint $key2
  * @return bool
  */
 public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2)
 {
     if (array_map('strtolower', $key1->getLocalColumns()) != array_map('strtolower', $key2->getLocalColumns())) {
         return true;
     }
     if (array_map('strtolower', $key1->getForeignColumns()) != array_map('strtolower', $key2->getForeignColumns())) {
         return true;
     }
     if ($key1->onUpdate() != $key2->onUpdate()) {
         return true;
     }
     if ($key1->onDelete() != $key2->onDelete()) {
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * @param ForeignKeyConstraint $key1
  * @param ForeignKeyConstraint $key2
  * @return bool
  */
 public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2)
 {
     if (array_map('strtolower', $key1->getLocalColumns()) != array_map('strtolower', $key2->getLocalColumns())) {
         return true;
     }
     if (array_map('strtolower', $key1->getForeignColumns()) != array_map('strtolower', $key2->getForeignColumns())) {
         return true;
     }
     if ($key1->hasOption('onUpdate') && $key->hasOption('onUpdate')) {
         if ($key1->getOption('onUpdate') != $key2->getOption('onUpdate')) {
             return true;
         }
     } else {
         if ($key1->hasOption('onUpdate') != $key2->hasOption('onUpdate')) {
             return true;
         }
     }
     if ($key1->hasOption('onDelete') && $key2->hasOption('onDelete')) {
         if ($key1->getOption('onDelete') != $key2->getOption('onDelete')) {
             return true;
         }
     } else {
         if ($key1->hasOption('onDelete') != $key2->hasOption('onDelete')) {
             return true;
         }
     }
     return false;
 }