On 11/29/10 7:22 PM, Lideln wrote:
Hi there,
I just read the entire Symfony 2 quick tour. I found many useful and
smart things, which are great !
But I also wondered about a few (tiny) things, that are more about
ease of use.
Hope I get an answer here :)
The answer: Explicit is always better than implicit. In symfony1, we
have all kind of things that happen automagically. You know them and you
know how they, but a newcomer can just scratch its head to understand
what's going on. Futhermore, when you want to escape from the default
behavior, it's a bit more complex; also because you now have a different
way of doing things. Symfony2 basically solves these problems.
1) I'm sorry that we lost the ability to "return nothing" in the
action (which would default to a specific template). Instead now, we
have to write "$this->render('HelloBundle:Hello:index', array('name'
=> $name));", which is long and useless. I think the SF1.4 way was
quicker. (but I am definitely fond of the arguments-like new way of
dealing parameters :) )
Probably quicker to write but definitely less flexible. In Symfony2,
there is only one way, and the one true way is as flexible as you might
need.
2) Can't we define layouts in view.yml anymore ? Do we have to use "<?
php $view->extend('HelloBundle::layout') ?>" in every single view ?
The layout belongs to the template. So, it's much better now. Also, just
have a look at all the problems we have we the default layout in
symfony1 (and all the related tickets we just cannot solve easily). As
before, there is now only one way to define a layout. It is much easier
to learn and to master.
3) Is there a shortcut like "$view->render('hello')" (that would
default the namespace to the current one, if not specified) ?
Again, in symfony1, the fact that a partial for instance tries to
automatically determines the context falls apart pretty quickly (just
try that with a partial used in two different modules).
These are just tiny thoughts (and other ones that were even tinier so
I did not bother to write them), but as much as I find the SF2
features awesome, I find it a bit more complex to use (but maybe it's
also a question of habit).
When learning Symfony2, you need to put symfony1 aside and more
importantly, you need to use Symfony2 for a small project to understand
all the benefits of the new approach.
Thanks for the feedback,
Fabien
Thank you for your answers :)
A humble SF user.
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en