Created
August 23, 2011 17:10
-
-
Save lmammino/1165880 to your computer and use it in GitHub Desktop.
Playing with Symfony2 services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Oinm\ServiceBundle\DependencyInjection; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\Config\FileLocator; | |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |
use Symfony\Component\DependencyInjection\Loader; | |
/** | |
* This is the class that loads and manages your bundle configuration | |
* | |
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} | |
*/ | |
class ImageFilesystemStorageExtension extends Extension | |
{ | |
/** | |
* {@inheritDoc} | |
*/ | |
public function load(array $configs, ContainerBuilder $container) | |
{ | |
$configuration = new Configuration(); | |
$config = $this->processConfiguration($configuration, $configs); | |
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | |
$loader->load('ImageFilesystemStorage.xml'); | |
} | |
public function getAlias() | |
{ | |
return "oinm_imagefilesystemstorage"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<container xmlns="http://symfony.com/schema/dic/services" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | |
<parameters> | |
<parameter key="oinm_imagefilesystemstorage.imagespath">%kernel.root_dir%/../web/images/</parameter> | |
<parameter key="oinm_imagestorage.relativebaseurl">images/</parameter> | |
<parameter key="oinm_imagestorage.absolutebaseurl"></parameter> | |
<parameter key="oinm_imagestorage.useabsoluteurls">false</parameter> | |
</parameters> | |
<services> | |
<service id="oinm_imagefilesystemstorage" class="Oinm\ServiceBundle\Service\Image\ImageFilesystemStorage"> | |
<argument type="string">%oinm_imagefilesystemstorage.imagespath%</argument> | |
<argument type="string">%oinm_imagestorage.relativebaseurl%</argument> | |
<argument type="string">%oinm_imagestorage.absolutebaseurl%</argument> | |
<argument type="constant">%oinm_imagestorage.useabsoluteurls%</argument> | |
</service> | |
</services> | |
</container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment