コード例 #1
0
 /**
  * @param \Doctrine\ORM\Tools\Event\SchemaDropTableEventArgs $args
  */
 public function onSchemaDropTable(SchemaDropTableEventArgs $args)
 {
     $table = $args->getTable();
     if ($table instanceof Table) {
         foreach ($table->getColumns() as $column) {
             if (!$column->getType() instanceof \Doctrine\Spatial\DBAL\Types\Type) {
                 continue;
             }
             $args->preventDefault()->setSql("SELECT DropGeometryTable('" . $table->getQuotedName($args->getPlatform()) . "')");
             break;
         }
     } else {
         // We should check here if the table contains geometry columns but we
         // don't have a connection availabe to query the geometry_columns table.
     }
 }