2015-08-09 12:21
浏览 40

Symfony2 - doctrine获取表创建顺序

I am using Symfony 2.7, doctrine 2, MySQL. I'm trying to retrieve the tables creation order in a controller as when issuing

php app/console doctrine:generate:schema --dump-sql

but I only need the table names. So, for instance, if I have two tables like Product - Category I'd like to have an output which looks like this : array('Category', 'Product')

Using this documentation here's what I've done so far:

public function getTablesCreationOrderAction()
    $conn = $this->get('database_connection');
    $sm = $conn->getSchemaManager();
    $sequences = $sm->listSequences($this->getParameter('database_name'));

An exception is thrown at $sequences = $sm->listSequences.

Here's the exception I get:

Operation 'Doctrine\DBAL\Platforms\AbstractPlatform::getListSequencesSQL' is not supported by platform.

I don't know if this means that MySQL does not support the operation.


图片转代码服务由CSDN问答提供 功能建议

我正在使用Symfony 2.7,doctrine 2,MySQL。 我正在尝试检索表中的表创建顺序 发布时的控制器

php app / console doctrine:generate:schema --dump-sql

但我只需要表名。 例如,如果我有两个表,如 产品 - 类别我想要一个如下所示的输出:array('Category ','产品')


  public function getTablesCreationOrderAction()
 $ conn = $ this->  get('database_connection'); 
 $ sm = $ conn-> getSchemaManager(); 
 $ sequences = $ sm-> listSequences($ this-> getParameter('database_name')); 
 die(  ); 

$ sequences = $ sm-> listSequences抛出异常。

这里是 我得到的例外:

平台不支持操作'Doctrine \ DBAL \ Platforms \ AbstractPlatform :: getListSequencesSQL'。



  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题