3. symfony 1.0 â January 2007
âąâŻ Started as a glue between existing Open-Source libraries:
ââŻMojavi (heavily modiïŹed), Propel, Prado i18n, âŠ
âąâŻ Borrowed concepts from other languages and frameworks:
ââŻRouting, CLI, functional tests, YAML, Rails helpersâŠ
âąâŻ Added new concepts to the mix
ââŻWeb Debug Toolbar, admin generator, conïŹguration cascade, âŠ
4. symfony 1.2 â November 2008
âąâŻ Based on decoupled but cohesive components
â⯠Forms, Routing, Cache, YAML, ORMs, âŠ
âąâŻ Controller still based on Mojavi
â⯠View, Filter Chain, âŠ
5. symfony 1.4 â November 2009
âąâŻ Added some polish on existing features
âąâŻ Removed the support for deprecated features
âąâŻ Current LTS release, maintained until late 2012
23. <?php Everything is namespaced
namespace ApplicationHelloBundleController;
use SymfonyFrameworkWebBundleController;
class HelloController extends Controller
{
public function indexAction($name) Variables come from the routing
{
return $this->render('HelloBundle:Hello:index', array('name' => $name));
}
}
Template name Variables to pass
to the template
35. Replaces a lot of symfony 1 âthingsâ
sfConfig
All conïŹg handlers
sfProjectConfiguration /
sfApplicationConfiguration
sfContext (No Singleton anymore)
The conïŹguration cache system
⊠and some more
36. in one
easy-to-master
uniïŹed
and cohesive package
37. Thanks to the DIC,
ConïŹguration has never been
so easy and so ïŹexible
53. You choose the format you want
Pros Cons
XML validation verbose (not that much)
IDE completion & help
YAML concise needs the YAML component
simple to read no validation
easy to change no IDE auto-completion
PHP ïŹexible no validation
more expressive
62. Very Fast
thanks to a Smart
Caching mechanism
it always knows when to ïŹush the cache
63. /**
* Gets the 'swiftmailer.mailer' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Swift_Mailer A Swift_Mailer instance.
PHPDoc for auto-completion
*/
protected function getSwiftmailer_MailerService()
{
if (isset($this->shared['swiftmailer.mailer']))
return $this->shared['swiftmailer.mailer']; As fast as it could be
$instance = new Swift_Mailer($this->getSwiftmailer_Transport_SmtpService());
return $this->shared['swiftmailer.mailer'] = $instance;
}
81. A layout is just another template with _content as a special slot
A partial is just a template you embed in another one
A component is just another action embedded in a template
89. INFO: Matched route "blog_home" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'index', '_route' =>
'blog_home',))
INFO: Using controller "BundleBlogBundleController
PostController::indexAction"
INFO: SELECT s0_.id AS id0, s0_.title AS title1, s0_.html_body AS html_body2,
s0_.excerpt AS excerpt3, s0_.published_at AS published_at4 FROM sf_weblog_post
s0_ ORDER BY s0_.published_at DESC LIMIT 10 (array ())
90. INFO: Matched route "blog_post" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'show', '_format' =>
'html', 'id' => '3456', '_route' => 'blog_post',))
INFO: Using controller "BundleBlogBundleController
PostController::showAction »
INFO: SELECT s0_.id AS id0, s0_.title AS title1, s0_.html_body AS html_body2,
s0_.excerpt AS excerpt3, s0_.published_at AS published_at4 FROM sf_weblog_post
s0_ WHERE s0_.id = ? (array ( 0 => '3456',))
ERR: Post "3456" not found! (No result was found for query although at least
one row was expected.) (uncaught SymfonyComponentsRequestHandlerException
NotFoundHttpException exception)
INFO: Using controller "SymfonyFrameworkWebBundleController
ExceptionController::exceptionAction"
127. âŠand Symfony 2.0 uses
half the memory
needed by both symfony 1 and ZF
128. We have barely scratched the surface
of all the goodness of
Symfony 2.0
129. Controller except for the nice default pages
Autoloading
Cache via ZF - DI extension coming soon
CLI commands still missing
ConïŹguration
Database via Doctrine DBAL
Debug except Timer and extended WDT
Escaper
Event Dispatcher
Form / Validation / Widget can use the 1.4 version as is
Admin Generator
Helpers
I18n / L10n can use the 1.4 version as is
Logger via ZF
Mailer except commands
Bundles except installing
Doctrine Plugin just the DBAL part
Propel Plugin
Request / Response
Routing no REST support, no Object support
Storage / User
Test
View