em = $em; return $this; } /** * Gets EntityManager. * * @return EntityManager * * @throws RuntimeException */ public function getEntityManager() { if (null === $this->em) { throw new RuntimeException('EntityManager must be injected.'); } return $this->em; } /** * @inheritdoc */ public function up(Schema $schema) { $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); $this->doUpSql($schema); return $this; } /** * @inheritdoc */ public function down(Schema $schema) { $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); $this->doDownSql($schema); return $this; } /** * Executes update SQL. */ abstract public function doUpSql(Schema $schema); /** * Execute downgrade SQL. */ abstract public function doDownSql(Schema $schema); }