I have to develop complex web application in symfony 2 where i have 20 database entites and many to many relationships.
I am experienced programmer but i am new to this symfony and OOP.
Is there any tutorial where i i can see many entitties and repositories and thier relationship as an example to start with
thanks
KnpBundles.com is rather complex and available on github.
LilaConceptsBestPracticeBundle is another great bundle showing Symfony 2.1 best practices (covering integration with Travis CI, Code styles fixer, Composer, etc).
I highly recommend these for everybody who is looking for best-practices (like me). :)
I don't know of any very complex tutorials of Symfony2 yet made to the public, but here are some good ones that helped me start out when I was first learning Symfony2:
1) Symblog: http://tutorial.symblog.co.uk/
2) Jobeet: http://sftuts.com/doc/jobeet/en/starting-up-the-project
But I probably learned the most from just reading over the thorough the book/cookbook available on the symfony2 website: http://symfony.com/doc/current/book/index.html
Symfony2 is strictly object oriented, so you might want to read up on OOP as well if you're new to the concept.
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 started using Symfony 2 after having experience with 5 php frameworks like Zend, CodeIgniter, Fuel, Yii and Cake. I am very confused on how to structure my project as better as I can. First of all I am confused in working with bundles. Bundles are some kind of modules used in other frameworks? Bascially I have my application and everything until now is stored in a bundles. If I want to make some helper functions and some libraries and abstract classes, I just make a new bundle for those?
See the Bundle Structure and Best Practices cookbook entry for basic ideas on the structure of a bundle.
I recommend having just one app specific bundle. I call it AppBundle.
Also, you don't have to have everything in bundles. Check this question for details.
Lots of other discussions on that matter:
Should everything really be a bundle on Symfony 2?
Confused with symfony2 bundles
I'm developing Code Igniter as framwork and i want to switch to Symfony but the problem is that I don't even know if I have bad habits with MVC or Framwork in general.
I know it's a quite subjective question, but I thought it could be a good idea to ask people who has already practice with this framework.
So if you have some Do's and Dont's about framworks in general or more accurately about Symfony I would be grateful !
Timon.
The Documentation on the Symfony website is all you need - its very extensive and will help you learn the framework quickly and in depth
Check your applications before deployment with list on http://symfony-check.org/
These are some tips:
Don't modify css/javascript codes from the web directory, you
must edit them in your src bundles, then assets:install, and
assetic:dump.
Never try to mix PHP and twig codes
Never edit the framework bundles (the vendors folder)
Use fixtures for your tests.
Try to avoid dependencies between bundles. Every bundle should be
independent of the others.