Esta presentación es la versión simplificada de la que se utilizó en las primeras Jornadas Symfony. Puedes ver la grabación en vídeo de la presentación original en http://bit.ly/symfony2
- - - - - - -
This is the simplified version of the presentation used at the first Spanish Symfony Conference. You can watch the video recording of the original presentation at http://bit.ly/symfony2
Hernandez_Hernandez_Practica web de la sesion 12.pptx
Symfony2, Jornadas Symfony
1. Jornadas Symfony 5 y 6 de julio 2010
Universitat Jaume I, Castellón
http://decharlas.uji.es/symfony
organizan patrocinan
colaboran
2. NOTA
Esta presentación es la versión simplificada de la que se
utilizó en las primeras Jornadas Symfony.
La presentación original está llena de efectos gráficos y
animaciones imposibles de utilizar en slideshare.net
Puedes ver la grabación en vídeo de la presentación
original en http://bit.ly/symfony2
Jornadas Symfony http://decharlas.uji.es/symfony
3. NOTE
This is the simplified version of the presentation used at
the first Spanish Symfony Conference.
The original presentation includes lots of cool effects and
animations that cannot be exported to slideshare.net
You can watch the video recording of the original
presentation at http://bit.ly/symfony2
Jornadas Symfony http://decharlas.uji.es/symfony
4. Symfony 2
Javier Eguíluz, symfony.es
Jornadas Symfony 5 y 6 de julio 2010
Universitat Jaume I, Castellón
http://decharlas.uji.es/symfony
25. 1.x 2.x
<?php <?php
class sfFilesystem class Filesystem
{ {
public function mkdirs($path, $mode = 0777) public function mkdirs($path, $mode = 0777)
{ {
if (is_dir($path)) if (is_dir($path)) {
{ return true;
return true; }
}
return @mkdir($path, $mode, true);
return @mkdir($path, $mode, true); }
}
public function touch($files)
public function touch($files) {
{ if (!is_array($files)) {
if (!is_array($files)) $files = array($files);
{ }
$files = array($files);
} foreach ($files as $file) {
touch($file);
foreach ($files as $file) }
{ }
touch($file);
}
}
Jornadas Symfony http://decharlas.uji.es/symfony
26. 1.x 2.x
<?php <?php
class sfFilesystem class Filesystem
{ {
public function mkdirs($path, $mode = 0777) public function mkdirs($path, $mode = 0777)
{ {
if (is_dir($path)) if (is_dir($path)) {
{ return true;
return true; }
}
EAR
return @mkdir($path, $mode, true);
/P
return @mkdir($path, $mode, true); }
end
}
Z
public function touch($files)
public function touch($files) {
{ if (!is_array($files)) {
if (!is_array($files)) $files = array($files);
{ }
$files = array($files);
} foreach ($files as $file) {
touch($file);
foreach ($files as $file) }
{ }
touch($file);
}
}
Jornadas Symfony http://decharlas.uji.es/symfony
27. 1.x 2.x
<?php <?php
class sfFilesystem class Filesystem
{ {
public function mkdirs($path, $mode = 0777) public function mkdirs($path, $mode = 0777)
{ {
if (is_dir($path)) if (is_dir($path)) {
{ return true;
return true; }
}
return @mkdir($path, $mode, true);
2 espacios 4 espacios
return @mkdir($path, $mode, true); }
}
public function touch($files)
public function touch($files) {
{ if (!is_array($files)) {
if (!is_array($files)) $files = array($files);
{ }
$files = array($files);
} foreach ($files as $file) {
touch($file);
foreach ($files as $file) }
{ }
touch($file);
}
}
Jornadas Symfony http://decharlas.uji.es/symfony
28. 1.x 2.x
<?php <?php
class sfFilesystem class Filesystem
{ {
public function mkdirs($path, $mode = 0777) public function mkdirs($path, $mode = 0777)
{ {
if (is_dir($path)) if (is_dir($path)) {
{ return true;
if ( )
return true; }
}
if ( ) {
return @mkdir($path, $mode, true);
} {
return @mkdir($path, $mode, true); }
...
...
public function touch($files)
}
public function touch($files) {
{ if (!is_array($files)) {
{ }
if (!is_array($files))
$files = array($files);
}
$files = array($files);
} foreach ($files as $file) {
touch($file);
foreach ($files as $file) }
{ }
touch($file);
}
}
Jornadas Symfony http://decharlas.uji.es/symfony
29. <?php
namespace SymfonyFrameworkFoundationBundle;
use SymfonyComponents...ContainerInterface;
use SymfonyComponentsHttpKernelRequest;
use SymfonyComponentsHttpKernelResponse;
use SymfonyComponents...HttpKernelInterface;
class Controller
{
protected $container;
protected $request;
...
Jornadas Symfony http://decharlas.uji.es/symfony
132. oferta:
pattern: /ofertas/:id
...
public function ofertaAction($id)
{
...
}
Jornadas Symfony http://decharlas.uji.es/symfony
133. oferta:
pattern: /ofertas/:seccion/:categoria
...
public function ofertaAction($seccion, $categoria)
{
...
}
Jornadas Symfony http://decharlas.uji.es/symfony
134. public function indexAction()
1.x
{
$this->ofertas = $ofertas;
}
*Se supone que la plantilla es
indexSuccess.php
public function indexAction()
{
2.x
return $this->render(
'FrontendBundle:Default:index',
array('ofertas' => $ofertas)
);
}
Jornadas Symfony http://decharlas.uji.es/symfony
149. class Cliente
{
public $nombre;
public $fecha_nacimiento;
public $codigo_postal;
}
Jornadas Symfony http://decharlas.uji.es/symfony
150. class Cliente
{
/** @Validation({ @MinLength(3) }) */
public $nombre;
/** @Validation({ @Date }) */
public $fecha_nacimiento;
/** @Validation({ @MaxLength(5) }) */
public $codigo_postal;
}
Jornadas Symfony http://decharlas.uji.es/symfony
151. JSR 303 Bean Validation
Validating data is a common task that occurs throughout an
application, from the presentation layer to the persistence layer. Often
the same validation logic is implemented in each layer, proving to be
time consuming and error-prone. To avoid duplication of these
validations in each layer, developers often bundle validation logic
directly into the domain model, cluttering domain classes with
validation code that is, in fact, metadata about the class itself.
This JSR defines a metadata model and API for JavaBean validation.
The default metadata source is annotations, with the ability to override
and extend the meta-data through the use of XML validation
descriptors.
The validation API developed by this JSR is not intended for use in any
one tier or programming model. It is specifically not tied to either the
web tier or the persistence tier, and is available for both server-side
application programming, as well as rich client Swing application
developers. This API is seen as a general extension to the Java-Beans
object model, and as such is expected to be used as a core component
Jornadas Symfony http://decharlas.uji.es/symfony
186. ESI Language Specification 1.0
Edge Side Includes (ESI) is an XML-based markup language that
provides a means to assemble resources in HTTP clients. Unlike other
in-markup languages, ESI is designed to leverage client tools like
caches to improve end-user perceived performance, reduce processing
overhead on the origin server, and enhanced availability. ESI allows for
dynamic content assembly at the edge of the network, whether it is in a
Content Delivery Network, end-user's browser, or in a "Reverse Proxy"
IETF HTTP/1.1, part 6: Caching
right next to the origin server.
ESI is primarily intended for processing on surrogates (intermediaries
that operate on behalf of theAbstract
origin server, also known as "Reverse
Proxies") that understand the ESI language. However, its application is
not restricted to these devices. The control of where Protocol (HTTP) is an application-level
The Hypertext Transfer ESI is processed is
protocol for distributed, collaborative, hypermedia information
addressed in the Edge Architecture Specification. Its capability token is
ESI/1.0 ESI allows surrogates to treat parts document is Part 6 of the seven-part specification
systems. This of pages as cacheable
resources, which gives them that ability tothe protocol referred to as "HTTP/1.1" and, taken
the defines serve resources from cache
in more situations. together, obsoletes RFC 2616. Part 6 defines requirements on
HTTP caches and the associated header fields that control cache
behavior or indicate cacheable response messages.
Jornadas Symfony http://decharlas.uji.es/symfony