1

I am using Doctrine2 with codeigniter. my project has created but i have to add prefix in database table. In codeigniter I have solved this issue with dbprefix $db['default']['dbprefix'].
But Doctrine not support it because Entity classes are not created with prefix. So it can't find Table.

I want to add table prefix in doctrine also without change in Entity class name of doctrine. Is there any possibility to add some prefix.

I have search TablePrefix Class but this class not working in my Doctrine library.

Previously Project created without prefix table name like "user" and entity annotation has also created with "User". But now I added prefix in all table "my_user"

Please Help!!

1 Answer 1

1

You can add a table prefix by using Doctrines event manager as described in the Doctrine documentation here:

http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/sql-table-prefixes.html

In a previous question, simshaun has given a good example of how to implement this in symphony:

How to setup table prefix in symfony2

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

3 Comments

:- Doesn't happend same error as previous user table not found
Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.user' doesn't exist'

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.