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
Related
I've got a huge site that has been written (in a very bad way) in symfony 1.4
now, I've been asked to make some substantial changes to the navigation flow, add some features and so on..
considering the effort, I was wondering if it would be better to take the radical decision to port the entire website to symfony 2.0, but I'm not sure how hard that it could be.
Has anybody ever done this before?
Do you have any suggestion to make for patterns to follow, or tutorials or doc or whatever?
You may wrap your legacy project in a brand new sf2 project, by using this bundle. This way, you'll be able to migrate your project one piece at a time, and new functionalities may be developed with sf2 as soon as you get the wrapper to work.
You may be interested by this post about migrating
Here's how I would go about it:
You need to learn and study some things first:
HTTP fundamentals
PHP namespaces, which are heavily used
Symfony2 documentation
Symfony2 documentation
Symfony2 documentation
PHPUnit documentation
Then when you get the hang of Symfony2, you need to find out what to reuse from your old project:
Models, business logic?
Did you use Doctrine in symfony? If yes, look at how to port your entities to Doctrine2, and learn about the differences. If you used Propel, I would look at switching to Doctrine2 and not use the PropelBundle, atleast until you get used to Symfony2. You can find better documentation and sample code out there for Doctrine2.
You also need to convert your old helpers classes to Symfony2 services.
Views?
Symfony2 uses Twig as templating engine, but you could go with pure PHP.
Controllers?
This should feel somewhat similar to symfony. The flow of Symfony2 matches the HTTP flow, meaning you get a Request object and must reurn a Response object.
It really depends on how well structured our old project is. Symfony2 is an entirely different beast than 1.0-1.4. I would probably not call it a port, but a rewrite - however, if your old project is well structured you could probably reuse quite a bit.
Without actually seeing your code, it's impossible to give a good answer on how hard it would be. It's very much doable, but there is no easy route. Symfony2 is, IMHO, the way of the future for PHP projects and in the end you will get a project that is much easier to maintain and support.
I am interested in learning Zend Framework 2.x, and I've noted that there are many good books written about ZF 1.8, 1.9, etc... however, I haven't come across any that explicitly states it is for ZF2 (except for one, and it was written in German).
In order to learn ZF, I could sit an learn it through the documentation... however, that sounds rather unsavory, despite the fact that it contains the latest information and arguably is the "best" source. I would like to endeavor in the more abundant sources on versions 1.8 or 1.9 as I learn this framework.
How much overlap is there between 1.8/1.9 to 2.x? I know 2.x uses namespaces and many new PHP 5.3.x features, but are there really that many changes between the implementation of these versions that I would be wasting my time trying to learn anything less than 2.0?
I'm aware that even if there is a large amount of compatibility, I would still have to come back and fill in a few "knowledge gaps". I'm just looking for a quick run down of the framework overall.
Thank you for your time.
Zend Framework 2 is very different from ZF1. It's core has been rewritten and the MVC structure has changed quite a bit.
The blog post announcing ZF2 goes into some detail on what has changed and why so I would recommend reading that. If you haven't used ZF1 extensively, you won't know some of the components they are talking about but that's okay. But as it states, ZF2 will look alien to those familiar with ZF1. Part of this is the new MVC structure and there are many new core components not available before including the ModuleManager, ServiceManager, and EventManager which provide better ways of accomplishing tasks that were more abstract to accomplish in ZF1.
Unless you plan on working with ZF1 projects, there isn't much sense in learning it at this point; I'd jump right into learning ZF2 at this point. If you were to learn ZF2 now and come across a ZF1 application down the road, there will be things you run into you aren't familiar with but largely you should be able to understand what's going on and get in and edit the application and learn what you need to know as you go.
Since the libraries provided by ZF1 and ZF2 are able to be used standalone, it would be possible to use some ZF2 classes in ZF1 as long as those classes aren't too tightly coupled to other classes in ZF2. For example, you can use Zend\Crypt from ZF2 standalone quite easily, but trying to use Zend\Form might be a different story since its tied to views, validators, filters and other classes.
As for learning ZF2, like you said there aren't many books around yet since its so new, but there are a lot of resources available for learning it aside from the reference guide.
I'd recommend looking at Getting Started with ZF2, the ZF2 Skeleton App, as well as the Zend Webinars where you can already find some great ZF2 tutorials including a presentation called Getting Started with ZF2 presented by The Zend Framework project lead Matthew Weier O'Phinney. There's also an upcoming webinar about MVC that's worth registering for (its free).
Hope that answers your question!
I've got a huge site that has been written (in a very bad way) in symfony 1.4
now, I've been asked to make some substantial changes to the navigation flow, add some features and so on..
considering the effort, I was wondering if it would be better to take the radical decision to port the entire website to symfony 2.0, but I'm not sure how hard that it could be.
Has anybody ever done this before?
Do you have any suggestion to make for patterns to follow, or tutorials or doc or whatever?
You may wrap your legacy project in a brand new sf2 project, by using this bundle. This way, you'll be able to migrate your project one piece at a time, and new functionalities may be developed with sf2 as soon as you get the wrapper to work.
You may be interested by this post about migrating
Here's how I would go about it:
You need to learn and study some things first:
HTTP fundamentals
PHP namespaces, which are heavily used
Symfony2 documentation
Symfony2 documentation
Symfony2 documentation
PHPUnit documentation
Then when you get the hang of Symfony2, you need to find out what to reuse from your old project:
Models, business logic?
Did you use Doctrine in symfony? If yes, look at how to port your entities to Doctrine2, and learn about the differences. If you used Propel, I would look at switching to Doctrine2 and not use the PropelBundle, atleast until you get used to Symfony2. You can find better documentation and sample code out there for Doctrine2.
You also need to convert your old helpers classes to Symfony2 services.
Views?
Symfony2 uses Twig as templating engine, but you could go with pure PHP.
Controllers?
This should feel somewhat similar to symfony. The flow of Symfony2 matches the HTTP flow, meaning you get a Request object and must reurn a Response object.
It really depends on how well structured our old project is. Symfony2 is an entirely different beast than 1.0-1.4. I would probably not call it a port, but a rewrite - however, if your old project is well structured you could probably reuse quite a bit.
Without actually seeing your code, it's impossible to give a good answer on how hard it would be. It's very much doable, but there is no easy route. Symfony2 is, IMHO, the way of the future for PHP projects and in the end you will get a project that is much easier to maintain and support.
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 working on a small project (some mark tracking software for a school subject department - PHP frontend with a sqlite DB) and have decided to use ORM.
I've taken a look at RedBeanPHP but it seemed a bit too limited for my liking. As such, I've decided to give Doctrine a go.
My only prior experience with ORM is LINQ to SQL in .NET. Anyway, I was wondering if I should get started with Doctrine 2.0 (which is in beta at the moment) or if I should take sometime to learn 1.2.
I'm looking for feedback from those who are comfortable with both, and more importantly, I'd like to know how complete the Doctrine 2.0 documentation is. Is there enough information on the website for somebody new to Doctrine (and quite new to ORM) to get up and running with 2.0 or is the documentation for the new version still quite lacking?
Doctrine 2 is a DataMapper ORM whereas 1.2 is Active Record. I would go with 2.0; the documentation is great
The Doctrine2 documentation is quite good already. I'd start with the reference.
I've been developing with Doctrine2 for a few months now, and have had no issues. I'll be going into production with it soon, and am pretty confident.
2.0's DataMapper pattern is really superior to the 1.2/ActiveRecord model. Very flexible, and possible more performant. If you're starting development today, I think it's very likely the best way to go.