I'm using NDBCLUSTER engine in a MySQL DB. I've added a class for wrapping Connection and adding the engine option:
namespace AppBundle\DBAL;
use Doctrine\DBAL\Connection as BaseConnection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Configuration;
use Doctrine\Common\EventManager;
class Connection extends BaseConnection
{
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
{
if (isset($params['driverOptions']['engine'])) {
$params['defaultTableOptions']['engine'] = $params['driverOptions']['engine'];
}
return parent::__construct($params, $driver, $config, $eventManager);
}
}
I define the engine option in the config.yml file:
doctrine:
dbal:
default_connection: default
connections:
default:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
wrapper_class: AppBundle\DBAL\Connection
options:
engine: NDBCLUSTER
orm:
auto_generate_proxy_classes: "%kernel.debug%"
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
AppBundle: ~
Then, if I execute php app/console doctrine:migrations:diff the NDBCLUSTER engine is added to the CREATE statements. However, the foreign keys are added too, and NDBCLUSTER does not accept foreign keys. Is there any way to disable the foreign keys (I mean, not writing them in the migration files)?