Hi Marco,

Prefixing the @Table with schema name worked however because the schema 
name is hardcoded, when I am running our integration tests the database 
that is queried is live not the test one. Even though we do have in our 
config_test.yml only test connections configured. 

For better understanding I've committed sample symfony application which 
hopefully will demonstrate what I am trying to achieve.

There was another issue I've had with the symfony mapping, but this might 
be due to some symfony limitation. I had to put my Inventory entity in the 
same bundle as my main Contact entity even though they both used different 
connections.

Is there something I am doing wrong? Is this possible at all?

https://github.com/robotzero/doctrine_demo

Thanks,
A.

On Thursday, 18 February 2016 07:45:18 UTC, Marco Pivetta wrote:
>
>
> On 17 February 2016 at 22:26, 'A K' via doctrine-user <
> [email protected] <javascript:>> wrote:
>
>> Hi
>>
>> Is there a way to change the schema name in the annotation dynamically 
>> depending on environment? 
>>
>
> Not at runtime. You'd use a metadata on-load listener ( 
> http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-events
>  
> ), and that can only be done before the ORM is ready for use. Also: you 
> won't be able to cache metadata.
>
> For example we have standard production env that uses different database 
>> names than test env, that prefixes all database names with _test. Using 
>> your proposed annotation would cause all tests to use production database 
>> names which we do not want to happen.
>>
>
> Uhm... Just use a test database connection? :| 
>
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>   
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to