Zen Framework 2 add quotes to postgresql to sentences using schema #4308

Closed
Aryetis opened this Issue Apr 24, 2013 · 3 comments

Comments

Projects
None yet
4 participants

Aryetis commented Apr 24, 2013

Ok first of, I'm new to Zen framework. I fulfilled the tutorial, and I'm currently working on my first real project. Now that's said.

I manage to acces to my db and use the public scheme.
But when I try to acces to one of my schema, zen framework seems to add quotes because I end up with an error like this:

SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "data.agent" does not exist
LINE 1: SELECT "data.agent".* FROM "data.agent"
( complete error log here: http://pastebin.com/Gxxfkse3 )

Here's the getServiceConfig of my Module.php:

http://pastebin.com/yLmGBbbH

Just to be sure, I created an agent table in the public schema,
and changed new TableGateway('data.agent', $dbAdapter ,etc ...
by
new TableGateway('agent', $dbAdapter, ....
And it works, so my code seems to be fine. I'm using Zend\Db and a pgsql Pdo driver to connect to my db.

Modifica la base de datos, para que no sea necesario especificar el schema en la consulta

ALTER DATABASE "DBName"
SET search_path = schema1,schema2, schema3;

Member

Thinkscape commented Nov 10, 2013

Modifica la base de datos, para que no sea necesario especificar el schema en la consulta

@fernandom2010 English please.

Member

ralphschindler commented Apr 16, 2014

If you'd like to provide both the table and schema, please use the TableIdentifier object:

return new TableGateway(new TableIdentifier('agent', 'data'), $dbAdapter, null, $resultSetPrototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment