Add container aware trait

This commit is contained in:
endroid 2013-07-13 18:01:02 -04:00 committed by Fabien Potencier
parent 63e6368dc0
commit 4c9e606ea5
2 changed files with 40 additions and 0 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
2.4.0
-----
* added ContainerAwareTrait to add default container aware behavior to a class
2.2.0
-----

View File

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection;
/**
* ContainerAware trait.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
trait ContainerAwareTrait
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* Sets the Container associated with this Controller.
*
* @param ContainerInterface $container A ContainerInterface instance
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}