-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mmoreram
committed
Dec 16, 2013
0 parents
commit 725ac50
Showing
17 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build | ||
phpunit.xml | ||
Resources/doc/_build/* | ||
coverage | ||
composer.lock | ||
vendor | ||
composer.phar | ||
phpcs.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\Annotation\Abstracts; | ||
|
||
use Doctrine\Common\Annotations\Annotation as DoctrineAnnotation; | ||
|
||
/** | ||
* Flush annotation driver | ||
* | ||
* @Annotation | ||
*/ | ||
abstract class Annotation extends DoctrineAnnotation | ||
{ | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\Annotation; | ||
|
||
use Mmoreram\ControllerExtraBundle\Annotation\Abstracts\Annotation; | ||
|
||
/** | ||
* Flush annotation driver | ||
* | ||
* @Annotation | ||
*/ | ||
class Flush extends Annotation | ||
{ | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\Annotation; | ||
|
||
use Mmoreram\ControllerExtraBundle\Annotation\Abstracts\Annotation; | ||
|
||
/** | ||
* Form annotation driver | ||
* | ||
* @Annotation | ||
*/ | ||
class Form extends Annotation | ||
{ | ||
|
||
/** | ||
* @var string | ||
* | ||
* Variable where to put generated object | ||
*/ | ||
public $variable; | ||
|
||
|
||
/** | ||
* @var entity | ||
* | ||
* Entity from paramconverter process to use where building form | ||
*/ | ||
public $entity; | ||
|
||
|
||
/** | ||
* @var boolean | ||
* | ||
* Handle request | ||
*/ | ||
public $handleRequest = false; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\Annotation; | ||
|
||
use Mmoreram\ControllerExtraBundle\Annotation\Abstracts\Annotation; | ||
|
||
/** | ||
* Flush annotation driver | ||
* | ||
* @Annotation | ||
*/ | ||
class Paginator extends Annotation | ||
{ | ||
|
||
/** | ||
* @var string | ||
* | ||
* Entity | ||
*/ | ||
public $entity; | ||
|
||
|
||
/** | ||
* @var string | ||
* | ||
* Number of Results per page | ||
*/ | ||
public $number; | ||
|
||
|
||
/** | ||
* @var string | ||
* | ||
* Page | ||
*/ | ||
public $page; | ||
|
||
|
||
/** | ||
* @var string | ||
* | ||
* OrderBy field in Route | ||
*/ | ||
public $orderByField; | ||
|
||
|
||
/** | ||
* @var array | ||
* | ||
* Mapper for OrderBy field | ||
*/ | ||
public $orderByFieldMapper = array(); | ||
|
||
|
||
/** | ||
* @var string | ||
* | ||
* OrderBy mode ( asc or desc ) | ||
*/ | ||
public $orderByMode; | ||
|
||
|
||
/** | ||
* @var array | ||
* | ||
* Mapper for OrderBy mode | ||
*/ | ||
public $orderByModeMapper = array(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtra; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
use Doctrine\Common\Annotations\AnnotationRegistry; | ||
|
||
/** | ||
* ControllerExtraBundle, an extension of Bundle | ||
*/ | ||
class ControllerExtraBundle extends Bundle | ||
{ | ||
|
||
/** | ||
* Boots the Bundle. | ||
*/ | ||
public function boot() | ||
{ | ||
$kernel = $this->container->get('kernel'); | ||
|
||
AnnotationRegistry::registerFile($kernel | ||
->locateResource("@ControllerExtraBundle/Annotation/Form.php") | ||
); | ||
|
||
AnnotationRegistry::registerFile($kernel | ||
->locateResource("@ControllerExtraBundle/Annotation/Flush.php") | ||
); | ||
|
||
AnnotationRegistry::registerFile($kernel | ||
->locateResource("@ControllerExtraBundle/Annotation/Paginator.php") | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* Dependency Injection configuration | ||
*/ | ||
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$rootNode = $treeBuilder->root('controller_extra'); | ||
|
||
$rootNode | ||
->children() | ||
->arrayNode('form') | ||
->addDefaultsIfNotSet() | ||
->children() | ||
->scalarNode('active') | ||
->defaultTrue() | ||
->end() | ||
->end() | ||
->end() | ||
->arrayNode('flush') | ||
->addDefaultsIfNotSet() | ||
->children() | ||
->scalarNode('active') | ||
->defaultTrue() | ||
->end() | ||
->end() | ||
->end() | ||
->arrayNode('paginator') | ||
->addDefaultsIfNotSet() | ||
->children() | ||
->scalarNode('active') | ||
->defaultTrue() | ||
->end() | ||
->scalarNode('number_default') | ||
->defaultValue(10) | ||
->end() | ||
->scalarNode('page_default') | ||
->defaultValue(1) | ||
->end() | ||
->scalarNode('orderby_field_default') | ||
->defaultValue('id') | ||
->end() | ||
->scalarNode('orderby_mode_default') | ||
->defaultValue('desc') | ||
->end() | ||
->end() | ||
->end() | ||
->end(); | ||
|
||
return $treeBuilder; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Controller Extra Bundle | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @since 2013 | ||
*/ | ||
|
||
namespace Mmoreram\ControllerExtraBundle\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
/** | ||
* This is the class that loads and manages your bundle configuration | ||
*/ | ||
class ControllerExtraExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$configuration = new Configuration(); | ||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
$container->setParameter('mmoreram.controllerextra.form_active', $config['form']['active']); | ||
$container->setParameter('mmoreram.controllerextra.flush_active', $config['flush']['active']); | ||
$container->setParameter('mmoreram.controllerextra.paginator_active', $config['paginator']['active']); | ||
$container->setParameter('mmoreram.controllerextra.paginator_number_default', $config['paginator']['number_default']); | ||
$container->setParameter('mmoreram.controllerextra.paginator_page_default', $config['paginator']['page_default']); | ||
$container->setParameter('mmoreram.controllerextra.paginator_orderby_field_default', $config['paginator']['orderby_field_default']); | ||
$container->setParameter('mmoreram.controllerextra.paginator_orderby_mode_default', $config['paginator']['orderby_mode_default']); | ||
|
||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('parameters.yml'); | ||
$loader->load('services.yml'); | ||
} | ||
} |
Oops, something went wrong.