Doctrine Relations and Zend MVC
This short podcast covers how you can easily build a form using Zend’s MVC model via Zend_Controller and using Doctrine for persistence.
You can download the source code or browse it online. Enjoy!
This short podcast covers how you can easily build a form using Zend’s MVC model via Zend_Controller and using Doctrine for persistence.
You can download the source code or browse it online. Enjoy!
This episode of zendcasts will cover how we can write Data Fixtures and extend our data model to include a simple one-to-many using Doctrine’s schema.yml file. I also noticed in the code of my last example that Model loading wasn’t working properly. I cover the fix in the video, however I’d like to highlight it here too. In your _initDoctrine() method, make sure you load the models:
Doctrine::loadModels($doctrineConfig['models_path']);
also, I’d like to extend a welcome to the folks at ServerGrove Networks for sponsoring this episode of Zendcasts. ServerGrove specializes in Zend Framework hosting and they’ve offered a 10% rebate on hosting with coupon code “zc“. If you’re looking for a host, be sure to check them out.
Grab a copy of the project or browse the repository.
Edit: I spoke to Guilherme Blanco (one of the core developers behind Doctrine) and he kindly brought up some things I should bear in mind for my Doctrine / Zend set.
Doctrine’s autoloader configuration can be scaled back by doing PEAR style Model Loading (new to 1.2). Also, you can use Doctrine_Core instead of Doctrine since everything has been moved to Doctrine_Core in order to follow Zend-style namespacing.
lastly, you can register your own CLI tasks as part of Doctrine’s CLI script or just write them in the scripts/doctrine.php file. With this, you could have your newly-generated models placed in the necessary folders. I’ll be experimenting with this in the coming week.
Building on the Introduction to Doctrine 1.2 video, this video will show how you can easily test the persistence of Doctrine models within the Zend_Test environment.
I also touch briefly on how to setup the latest version of MAMP with phpunit.
Edit: I spoke to Guilherme Blanco (one of the core developers behind Doctrine) and he kindly brought up some things I should bear in mind for my Doctrine / Zend set.
Doctrine’s autoloader configuration can be scaled back by doing PEAR style Model Loading (new to 1.2). Also, you can use Doctrine_Core instead of Doctrine since everything has been moved to Doctrine_Core in order to follow Zend-style namespacing.
lastly, you can register your own CLI tasks as part of Doctrine’s CLI script or just write them in the scripts/doctrine.php file. With this, you could have your newly-generated models placed in the necessary folders. I’ll be experimenting with this in the coming week.
Enjoy!
By popular demand, I’ve put together an introduction to Doctrine 1.2 integration with the Zend Framework. Doctrine is a fantastic ORM (object-relational mapping tool). If you’ve jumped from NHibernate or Hibernate and are itching to have a powerful tool for handling database relationships, Doctrine is probably your best bet. On the mailing lists, there’s a lot of talk about integrating Doctrine 2.0 into the 2.0 release of the Zend Framework. Regardless, this will help you get up to speed today. In next week’s video, I’ll show you how you can unit test those models in the Zend Framework.
Enjoy!
Edit: I spoke to Guilherme Blanco (one of the core developers behind Doctrine) and he kindly brought up some things I should bear in mind for my Doctrine / Zend set.
Doctrine’s autoloader configuration can be scaled back by doing PEAR style Model Loading (new to 1.2). Also, you can use Doctrine_Core instead of Doctrine since everything has been moved to Doctrine_Core in order to follow Zend-style namespacing.
lastly, you can register your own CLI tasks as part of Doctrine’s CLI script or just write them in the scripts/doctrine.php file. With this, you could have your newly-generated models placed in the necessary folders. I’ll be experimenting with this in the coming week.
Grab a copy of the project or browse the repository.