I know there are other ways to archive this, but the question is... which are the cons about something like:
MyGlobalConfig.php
<?php
namespace Acme\DemoBundle;
class MyGlobalConfig
{
public static $uploadsDir;
}
AppKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Acme\DemoBundle\MyGlobalConfig;
class AppKernel extends Kernel
{
public function __construct($environment, $debug)
{
MyGlobalConfig::$uploadsDir = __DIR__ .'/../uploads';
parent::__construct($environment, $debug);
}
Article.php
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Acme\DemoBundle\MyGlobalConfig;
/**
* @ORM\Entity
*/
class Article
{
protected function getUploadsDir()
{
return MyGlobalConfig::$uploadsDir;
}