[英]Get names of all tables. Doctrine + Codeigniter
I need to find a doctrine function that allow me make a query of all the names of the tables of my database. 我需要找到一个教义函数,使我可以查询数据库表的所有名称。
I have found solutions, for example this one. 我找到了解决方案,例如这一方案。 (You need to put the entity to the function and it will return the name of the table.)
(您需要将实体放入函数中,它将返回表的名称。)
$em = $this->getDoctrine()->getEntityManager();
$tableName = $em->getClassMetadata('StoreBundle:User')->getTableName();
This is not what I need. 这不是我所需要的。 What I would do in SQL would be:
我将在SQL中执行的操作是:
show tables in database_name;
It returns the names of all the tables in my database. 它返回数据库中所有表的名称。
I need to do that using Doctrine. 我需要使用Doctrine。
因为这是用codeigniter标记的,所以我会给出codeigniter的答案。
$this->db->list_tables();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.