if i do integrate Zend Framework 1.10 with Doctrine 2 where do i put my Doctrine Models/Entities and Proxies? i thought of the /application
or the /library
directories. if i do put in the /library
directory tho, will it interfere with ZF autoloading classes from there since the classes there will be using PHP 5.3 namespaces vs PEAR style namespaces.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
I would put the Models in the same directory where the "normal" Zend Framework models life.
/models
You can tell Doctrine to generate the models at this place, and prefix them with
"Default_Model"
or whatever.Check out one of John Lebenshold Screencasts about Zend Framework and Doctrine
Zend Screencasts
In theory, you could put then anywhere, as long as the namespaces resolve correct.
I would suggest this structure:
Load the 'MyApp' using Doctrine's ClassLoader. I've had no conflicts using the Doctrine loader with the Zend Loader (if you have classes that use the PEAR convention inside your namespace folder, you will still need to use the Zend Loader).
Remember that 'models' can be more than just your Entity classes. My model layer consists of interfaces, factories, validators and service objects. To that end, anything that is application specific business logic should probably go in the model folder.
I'm working on an application that integrates Doctrine 2 with ZF1.10 also.You don't need to use the Doctrine auto loader at all.
1) In your application.ini file add the following line (assuming you have Doctrine installed in your library folder (same as the Zend folder):
2) Create a doctrine or entitymanager resource. In your ini file:
3) Next, you will need to bootstrap it. I added a resource class in my resources folder. Make sure you map to the folder in your ini file:
Then your resource class...
The doctrine 2 entity manager is now available to your application. In your controller you can grab it like so:
I am sure this will help somebody :)