Skip to content

Commit

Permalink
generated bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Nov 27, 2011
1 parent 2393817 commit 59eab92
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/AppKernel.php
Expand Up @@ -18,6 +18,7 @@ public function registerBundles()
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Acme\UserBundle\AcmeUserBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
Expand Down
5 changes: 5 additions & 0 deletions app/config/routing.yml
@@ -1,3 +1,8 @@
AcmeUserBundle:
resource: "@AcmeUserBundle/Controller/"
type: annotation
prefix: /

# Internal routing configuration to handle ESI
#_internal:
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
Expand Down
9 changes: 9 additions & 0 deletions src/Acme/UserBundle/AcmeUserBundle.php
@@ -0,0 +1,9 @@
<?php

namespace Acme\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeUserBundle extends Bundle
{
}
19 changes: 19 additions & 0 deletions src/Acme/UserBundle/Controller/DefaultController.php
@@ -0,0 +1,19 @@
<?php

namespace Acme\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class DefaultController extends Controller
{
/**
* @Route("/hello/{name}")
* @Template()
*/
public function indexAction($name)
{
return array('name' => $name);
}
}
28 changes: 28 additions & 0 deletions src/Acme/UserBundle/DependencyInjection/AcmeUserExtension.php
@@ -0,0 +1,28 @@
<?php

namespace Acme\UserBundle\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 AcmeUserExtension 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('services.xml');
}
}
29 changes: 29 additions & 0 deletions src/Acme/UserBundle/DependencyInjection/Configuration.php
@@ -0,0 +1,29 @@
<?php

namespace Acme\UserBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('acme_user');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.

return $treeBuilder;
}
}
20 changes: 20 additions & 0 deletions src/Acme/UserBundle/Resources/config/services.xml
@@ -0,0 +1,20 @@
<?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="acme_user.example.class">Acme\UserBundle\Example</parameter>
</parameters>
<services>
<service id="acme_user.example" class="%acme_user.example.class%">
<argument type="service" id="service_id" />
<argument>plain_value</argument>
<argument>%parameter_name%</argument>
</service>
</services>
-->
</container>
Empty file.
11 changes: 11 additions & 0 deletions src/Acme/UserBundle/Resources/translations/messages.fr.xliff
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>Symfony2 is great</source>
<target>J'aime Symfony2</target>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1 @@
Hello {{ name }}!
17 changes: 17 additions & 0 deletions src/Acme/UserBundle/Tests/Controller/DefaultControllerTest.php
@@ -0,0 +1,17 @@
<?php

namespace Acme\UserBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();

$crawler = $client->request('GET', '/hello/Fabien');

$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}

0 comments on commit 59eab92

Please sign in to comment.