I'm trying to get started with Doctrine for Zend. There doesn't seem to be a lot out there to help me with this. I find the website and documentation a bit useless.
I'm currently looking at this webpage.
There are a few options. I can checkout from subversion or github. Install via PEAR. or download a package.
What should I be doing with the lines of code in the black boxes?
What do I do with a package once I've extracted it?
As an aside
Am I a little out of my depth? Is there anything I should be learning before I start tackling Doctrine?
You really should have a look at the Zend Framework webinars, and more specifically the one called Zend Framework v1 + Doctrine v2. It's got detailed instructions and links to GitHub where you can download the source presented in the webinar.
The presentation slides can be found at http://static.zend.com/topics/Zend-Framework-1-+-Doctrine-2.pdf.
Presentation summary :
Zend Framework (version 1) is an
enterprise grade, full stack MVC
framework and component library.
Doctrine (version 2) is an enterprise
grade, ORM (object-relational mapping)
framework for PHP 5.3. In this
webinar, the ZF and Doctrine teams
join forces to demonstrate how best to
integrate these two frameworks and
produce a ZF powered MVC application
where in which the "M" is powered by
Doctrine2. Familiarity of PHP 5.3
features is suggested. Presenter –
Ralph Schindler, Jonathan Wage and
Guilherme Blanco (87min) Dec 15 2010
You will have to register with Zend though (but that's free, so shouldn't pose any problems I guess).
Actually, there are some resources you could use to integrate Zend Framework and Doctrine. In example, you could follow this screencasts:
ZendCasts - Doctrine
I've followed these screencasts, with a few corrections, and I was able to use Doctrine 1.x with Zend Framework applications. You can also view the generated screencasts' code; this option is available in the most of these screen casts.
You will want to use Doctrine 2, not version 1.2. The two are not compatible. Here is a presentation that explains why:
http://www.slideshare.net/ralphschindler/zend-framework-1-doctrine-2-6177485
Here are example sources for Zend Framework + Doctrine 2 integration:
https://github.com/fierycode/ZendFramework1-Doctrine2
https://github.com/marsbomber/zf1-doctrine2/tree/modular_setup (with modules)
I have already pointed someone in the right direction to integrate Doctrine 1.2 into ZF, my post can be found here.
I hope this helps you out.
Related
I was wondering if any one had any kind of success integrating a Zend Framework 2.0 beta in a Zend Framework 1.11 project.
I am currently building a project using ZF 1.11. I don't want to use ZF 2.0 yet since they say on the developpers blog that backward compatibility isn't guaranteed. The project developpement will span over a few months and I don't want to fix a lot of stuff when I update to the newest release (which will resolve bugs and vulnerabilities).
Is there a quick tutorial, or did anybody include a Zend Framework 2.0 module (using PHP namespaces) in a "vintage" Zend Framework release using includes?
An alternative possibility, if what you want is to introduce Dependency Injection in your ZF 1.11 project, is to use the Symfony DI component. I worked fine for me.
There are some web resources about the details, most notably this one: http://losohome.wordpress.com/2010/01/22/integrating-symfony-dependency-injection-service-container-with-zend-framework/
Hope that helps,
My advice at this stage is to develop your project with ZF 1.11. 2 will not be backwards compatible with ZF ZF 1.11, but there is talk of some tools / tutorials that will help to update, but I am very skeptical about it!
It seems that Symfony 2 is finally stable (correct me if I'm wrong) and I wish to transfer my projects from 1.4 to 2.0.
I checked google and symfony.com but there is no info about this topic. My guess that the framework got rewritten so deeply that no automatized tool can handle this.
Any ideas or guidelines?
Your guess is right, there is no automated tool that can convert your 1.4 project to 2.0, because the structure of the framework, although still MVC of course, is quite different to the 1.X versions.
You can see some of the key differences in this page of the Symfony2 Cookbook.
Also, bear in mind that Symfony2 requires PHP 5.3.2 or higher.
My advice would be, if your projects are finished and running in Symfony1.4, let them be, they'll be just fine, and start learning Symfony2 ;)
I am a newbie in PHP Frameworks and would like to share/discuss some experience with you guys. Getting straight to the point, what I understand till now (from a newby stand of point is this):
CodeIgniter + Doctrine + Twigg = Symfony:
Zend + Doctrine + Twigg = Symfony
Symfony 2, uses php5.3 (I realy like namespace stuff remind me .Net)
but it lucks of tutorials right now (only partial jobeet translation to ver2)
I enjoy CI community and noumerous tutorials, plus using Doctrine + Twigg I could achive the same with Symfony.
Zend is more enterprise with lots of tutorials, but more difficult to grasp than CI.
So the question is should I start with CI + Doctrine or learn directly Symfony2?
Am I correct with the above assumptions?
Start with CodeIgniter if you are new to frameworks. Both Symfony and ZF have a greater learning curve and if you're not familiar with some concepts you might get fustrated in the beginning with the more complex frameworks .
I would suggest you to go with Symfony 2 since it has got lots of good stuff built around it. Take a look at this article http://www.phparch.com/2010/02/symfony-2-benchmarks/.
Hope this link is very useful on learning Symfony 2. It's a tutorials based on days (21) teaching you how to create a calendar website. Good luck.
http://symfony.com/blog/do-you-know-jobeet
More:
http://symfony2easy.blogspot.com/
http://www.dobervich.com/2011/03/03/symfony2-blog-application-tutorial-part-i-project-setup/, http://www.dobervich.com/2011/03/05/symfony2-blog-application-tutorial-part-ii-the-data-model/, http://www.dobervich.com/2011/03/09/symfony2-blog-application-tutorial-part-iii-routing-controllers-and-templates/
it really adds up to what your requirements are.
Symfony is great, though my only bash on it is that it requires PHP 5.3, which is great, but make sure your host has 5.3 support. Also the issue of using CLI bugs me.
CodeIgniter 2 on the other hand requires 5.1.6, which is good for me as my host is still on 5.2; I also like how small CI was compared to Zend or Symfony. Now like you i like some of symfony's components and i use 2 of them (swift mailer & twig) on my CI install. doesnt mean you should just junk ci and go symfony. CI is built to be a stepping stone framework that you can build on. Symfony to me is a full-fledged framework with everything and the kitchen sink.
having said all that, not all frameworks are created equal. I use CI for one project and Kohana for another. Kohana offered me something i liked that CI didnt do and thats fine.
I think you should look at the different frameworks out there, some are full featured, some are bare-bones and allow you to grow with your needs.
You may quick start with Cygnite PHP Framework. Simple yet powerful tool to build your next project. It gives you exceptional performance. Check benchmark results:
Performance benchmark results
I'm using Zend Framework and I feel that I need a good ORM to work with. I don't know much of Zend Framework, I just know how to do the basics. I expect to work together with both Doctrine and Zend Framework
But to sget started, I'm going to try a simple Doctrine project (no ZF) to get used to the application. Then I'll try to integrate it in ZF
Which version of Doctrine do I start learning? Does Doctrine have a good integration with ZF?
Besides,
Is there any recent site for Doctrine learning? I just can't find the sandbox version to follow the Doctrine documentation. If anyone knows of any tutorial on how to get started with doctrine only first, please let me know
I've done projects with zend framework and doctrine. They play pretty nice together.
I followed this tutorial and it worked well.
But honestly I don't use doctrine on anything but the largest sites. I've switched over to RedBean. Zero configuration autodiscovery, and the ability to freeze data models when you are done for maximum performance.
You should really try it out, it is so simple its stupid. It is really one of the best ORM's ive ever used. EVER. Try it.
I am personally using Doctrine 1.2
and i followed the Zendcasts.com "more than 5 casts about doctrine" & same Byron's tuts
both of them is good
Update :
1- http://www.zendcasts.com/deep-integration-between-zend-and-doctrine-1-2/2010/01/ has the sample code
2- http://www.doctrine-project.org/projects/orm/1.2/download/1.2.3 has the doctrine framework if you need to download it alone
I've found Doctrine2 reasonable stable, although it's still in beta. It seems most of the other PHP 'ORM' libraries (Doctrine 1.2 included) are Active Record, while Doctrine2 is a Data Mapper. In my opinion, you can put together a relatively simple Active Record using Zend's native Db_Table, so that makes Doctrine 1.2 less appealing (at least to me).
I've used this answer about integrating Doctrine2 and Zend Framework.
I agree with Byron, and have only used Doctrine2 on select projects.
[As an aside, I've noticed RedBean in the past, and have wanted to try it - from what I've seen it's certainly worth taking a look.]
Doctrine 2 is in beta and requires PHP5.3 as it fully utilizes Namespaces. If you cannot use PHP5.3 in your project, you cannot use Doctrine 2.
Apart from that, there has been a number of architectural changes in Doctrine 2 that make it much more attractive than Doctrine < 2, mainly
using DataMapper instead of ActiveRecord
promotes DI over static calls
faster and less memory-intensive
revolves around Entities and DDD
uses "Annotations"
See
http://architects.dzone.com/articles/doctrine-1-doctrine-2
http://www.slideshare.net/jwage/doctrine-2-not-the-same-old-php-orm
I have never used any ORM, but the Zend_Db_Table (if you can call it one). I'd like give it a try with some famous ROM and I've only heard of these 2 (Propel and Doctrine).
I tried sometimes in the past but I found it too hard to integrate or maybe I didn't understand how it works.
Now that I'm trying again, I'd like to know which one has easier integration with Zend Framework and which one is easier to work and why
Doctrine and Propel are definitely the two best know PHP ORM's among some others.
Doctrine has definitely seen some more love from ZF and there is rumors that Doctrine 2 will play a major role in ZF2, though afaik nothing as been confirmed as of this writing.
Here is some links for you to follow:
Integrating Propel with the Zend Framework (2006)
Brandon Savage: The Adventures Of Merging Propel With Zend Framework
and
Ruben Vermeersch: Integrating Zend Framework and Doctrine 1.x
Matthew Weier O'Phinney: Autoloading Doctrine and Doctrine entities from Zend Framework
Doctrine 2 and Zend Framework first date
Also see these two questions that have additional information and links:
Zend Framework 1.9 and Doctrine Integration
Integrate Doctrine with Zend Framework 1.8 app
Should not be hard to find many more for Doctrine.
EDIT very nice one from Phil's comment:
Zend Framework / Doctrine integration suite