Weitere ähnliche Inhalte Ähnlich wie ZendFramework2 & Symfony2 (20) Kürzlich hochgeladen (20) ZendFramework2 & Symfony23. Arquitetura
Sf camp 2007, Dispatcher adicionado ao Sf 1.1
- Events
- Bundles
Andi/Matthew 2006 - phly
- Events
- Modules > Plugins*
Console :)
Console :( - ARGH!
4. Principais componentes em sua arquitetura
HttpFoundation, HttpKernel, Routing, EventDispatcher,
DependencyInjection e ClassLoader
ZendDI, ZendEventManager, ZendStdlib,
ZendLoaderStandardAutoloader, ZendServiceManager
6. API – Route
blog:
pattern: /
Defaults: { _controller: Bundle:Blog:index }
blog_rss:
pattern: /rss
Defaults: { _controller: Bundle:Blog:rss }
blog_rss_sub:
pattern: /rss/sub
Defaults: { _controller: Bundle:Blog:rssSub }
# ----- comment
comments:
pattern: /comments/{id}
defaults: { _controller: Bundle:Blog:comments }
requirements:
id: d+
#host: sf 2.2
$route = Part::factory(array(
'route' => array(
'type' => 'literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' =>
'ApplicationControllerIndexController',
'action' => 'index'
)
),
),
'route_plugins' => $routePlugins,
'may_terminate' => true,
'child_routes' => array(
'blog' => array(
'type' => 'literal',
'options' => array(
'route' => 'blog',
'defaults' => array(
'controller' =>
'ApplicationControllerBlogController',
'action' => 'index'
)
),
'may_terminate' => true,
'child_routes' => array(
'rss' => array(
'type' => 'literal',
'options' => array(
'route' => '/rss',
'defaults' => array(
'action' => 'rss'
)
),
'may_terminate' => true,
'child_routes' => array(
'subrss' => array(
'type' => 'literal',
'options' => array(
'route' => '/sub',
'defaults' => array(
'action' => 'subrss'
)
)
)
)
)
)
),
'forum' => array(
'type' => 'literal',
'options' => array(
'route' => 'forum',
'defaults' => array(
'controller' =>
'ApplicationControllerForumController',
'action' => 'index'
)
)
)
)
));
// Segment, Custom, Regex, Hostname
7. Module
<?php
namespace Album;
class Module
{
public function getAutoloaderConfig()
{
return array(
'ZendLoaderClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
),
'ZendLoaderStandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
}
8. Usando o que tem de melhor
API Simples
Bundles, Bundles, Bundles
Melhores componentes/desacoplados.
Config, Config, Config.