enhanced plugin support (#634)
- refactored admin controller and templates - plugin support for entity actions - changed column mail to email in customer table - refactored theme events
This commit is contained in:
@@ -11,6 +11,7 @@ namespace App\Doctrine;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration as BaseAbstractMigration;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
@@ -50,6 +51,55 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
return getenv('DATABASE_PREFIX') . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
*/
|
||||
public function preUp(Schema $schema): void
|
||||
{
|
||||
$this->abortIfPlatformNotSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
*/
|
||||
public function preDown(Schema $schema): void
|
||||
{
|
||||
$this->abortIfPlatformNotSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Abort the migration is the current platform is not supported.
|
||||
*
|
||||
* @throws DBALException
|
||||
*/
|
||||
protected function abortIfPlatformNotSupported()
|
||||
{
|
||||
$platform = $this->getPlatform();
|
||||
if (!in_array($platform, ['sqlite', 'mysql'])) {
|
||||
$this->abortIf(true, 'Unsupported database platform: ' . $platform);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
*/
|
||||
protected function isPlatformSqlite()
|
||||
{
|
||||
return ($this->getPlatform() === 'sqlite');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
*/
|
||||
protected function isPlatformMysql()
|
||||
{
|
||||
return ($this->getPlatform() === 'mysql');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
@@ -84,7 +134,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
protected function addSqlDropIndex($indexName, $tableName)
|
||||
{
|
||||
$dropSql = 'DROP INDEX ' . $indexName;
|
||||
if ($this->getPlatform() === 'mysql') {
|
||||
if (!$this->isPlatformSqlite()) {
|
||||
$dropSql .= ' ON ' . $tableName;
|
||||
}
|
||||
$this->addSql($dropSql);
|
||||
|
||||
Reference in New Issue
Block a user