{"action":"created","issue":{"url":"https://api.github.com/repos/laravel-doctrine/orm/issues/162","repository_url":"https://api.github.com/repos/laravel-doctrine/orm","labels_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/162/comments","events_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/162/events","html_url":"https://github.com/laravel-doctrine/orm/issues/162","id":161910803,"number":162,"title":"[BUG] Unable to select data after switching PostgreSQL Schema","user":{"login":"EspadaV8","id":115825,"avatar_url":"https://avatars.githubusercontent.com/u/115825?v=3","gravatar_id":"","url":"https://api.github.com/users/EspadaV8","html_url":"https://github.com/EspadaV8","followers_url":"https://api.github.com/users/EspadaV8/followers","following_url":"https://api.github.com/users/EspadaV8/following{/other_user}","gists_url":"https://api.github.com/users/EspadaV8/gists{/gist_id}","starred_url":"https://api.github.com/users/EspadaV8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EspadaV8/subscriptions","organizations_url":"https://api.github.com/users/EspadaV8/orgs","repos_url":"https://api.github.com/users/EspadaV8/repos","events_url":"https://api.github.com/users/EspadaV8/events{/privacy}","received_events_url":"https://api.github.com/users/EspadaV8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-06-23T12:29:27Z","updated_at":"2016-06-29T10:22:18Z","closed_at":null,"body":"### Package version, Laravel version\r\n1.0.21, Laravel 5.1.26 (LTS)\r\n\r\n### Expected behaviour\r\n\r\nAfter setting the `search_path` in PostgreSQL you should be able to run doctrine queries on tables within that schema.\r\n\r\n### Actual behaviour\r\n\r\nA `Doctrine\\DBAL\\Exception\\TableNotFoundException` is thrown with the message\r\n\r\n```\r\nSQLSTATE[42P01]: Undefined table: 7 ERROR:  relation \"jobs\" does not exist\r\n```\r\n\r\n### Steps to reproduce the behaviour\r\n\r\nWe are making heavy use of the [Laravel-PGSchema](https://github.com/pacuna/Laravel-PGSchema) package to switch between PostgreSQL schemas in a multitenancy application. With Eloquent this works without an issue but while attempting to do something similar using this package the following is thrown\r\n\r\n```\r\nDoctrine\\DBAL\\Exception\\TableNotFoundException with message 'An exception occurred while executing 'SELECT t0.id AS id_1, t0.effective_dates AS effective_dates_2, t0.person AS person_3, t0.source AS source_4, t0.recruitment_cost AS recruitment_cost_5, t0.created_at AS created_at_6, t0.updated_at AS updated_at_7, t0.deleted_at AS deleted_at_8 FROM jobs t0 WHERE t0.id = ? AND ((t0.deleted_at IS NULL))' with params [\"1\"]:\r\n\r\nSQLSTATE[42P01]: Undefined table: 7 ERROR:  relation \"jobs\" does not exist\r\nLINE 1: ... updated_at_7, t0.deleted_at AS deleted_at_8 FROM jobs t0 WH...\r\n```\r\n\r\nThis is run within the `tinker` command after running the following\r\n\r\n```\r\nPsy Shell v0.6.1 (PHP 7.0.7 — cli) by Justin Hileman\r\n>>> PGSchema::switchTo('espadav8');\r\n>>> $a = EntityManager::find('Lapis\\Domain\\Job\\DoctrineJob', '1');\r\n```\r\n\r\nThe schema exists within PostgreSQL and running a query via the `DB` facade returns an array of all the jobs within the table.\r\n\r\nIs there some way to work out how doctrine is connecting to the database because I'm assuming it's not using the same connection as the rest of the application.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/laravel-doctrine/orm/issues/comments/229317483","html_url":"https://github.com/laravel-doctrine/orm/issues/162#issuecomment-229317483","issue_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/162","id":229317483,"user":{"login":"maxbrokman","id":5322152,"avatar_url":"https://avatars.githubusercontent.com/u/5322152?v=3","gravatar_id":"","url":"https://api.github.com/users/maxbrokman","html_url":"https://github.com/maxbrokman","followers_url":"https://api.github.com/users/maxbrokman/followers","following_url":"https://api.github.com/users/maxbrokman/following{/other_user}","gists_url":"https://api.github.com/users/maxbrokman/gists{/gist_id}","starred_url":"https://api.github.com/users/maxbrokman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxbrokman/subscriptions","organizations_url":"https://api.github.com/users/maxbrokman/orgs","repos_url":"https://api.github.com/users/maxbrokman/repos","events_url":"https://api.github.com/users/maxbrokman/events{/privacy}","received_events_url":"https://api.github.com/users/maxbrokman/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T10:22:17Z","updated_at":"2016-06-29T10:22:17Z","body":"@patrickbrouwers I think sharing the connection could have other potential benefits, potentially simplifies logging?\r\n\r\nWe currently have two audit logs set up that that record all write queries to a file, one for each connection. Perhaps this would make it simpler (not looked at / tested the code)"}}
{"actor":{"display_login":"maxbrokman"}}