4

I'm trying to create a join across multiple databases (one of them belonging to a legacy application) as described in the Doctrine blog. However, the example suggests hardcoding the name of the database right into the schema, which I'd like to avoid for obvious reasons.

Is there a way to read parameters defined in parameters.ini or config.yml and use them as a value for the annotations, like this?

/**
 * @ORM\Table(name="%legacy_db_name%.%legacy_table_name%")
 */
0

1 Answer 1

1

No, it's impossible. The "%key%" form is only available in the DIC. Why would you put these data in a yml file? Would it be useful?

Sign up to request clarification or add additional context in comments.

2 Comments

The real place to configure these would obviously be in parameters.ini, I only suggested config.yml for the off chance it could be easier to access. Would it be possible to read the database and table names from the properties file if we described the entity in yml instead of annotation?
It's not really a question of reading the table names, D2 does not support what you want out of the box. I think I saw some stuff on how to set a listener on the D2 meta data and change things on the fly. That would be your first step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.