2017 © Pedro Peláez
 

symfony-bundle myclabs-enum-param-converter

image

ex3v/myclabs-enum-param-converter

  • Thursday, July 27, 2017
  • by Ex3v
  • Repository
  • 1 Watchers
  • 3 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 58 % Grown

The README.md

Ex3v\MyCLabsEnumParamConverterBundle

A simple Symfony bundle to enable seamless MyClabs\Enum param conversion in your controllers., (*1)

Build Status, (*2)

Installation and usage

1. Install via composer:
composer require ex3v/myclabs-enum-param-converter
2. Enable bundle:
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new \Ex3v\MyCLabsEnumParamConverterBundle\MyCLabsEnumParamConverterBundle(),
    );
}
3. Use in your controller:
/**
 * @ParamConverter("barType")
 */
public function fooAction(BarType $barType) : Response
{
    //...   
}

Note that you do not have to point out specific converter as long as you use typehints in your controller actions., (*3)

If you want to point out this converter explicitly, use following example:, (*4)

/**
 * @ParamConverter("barType", converter="converter_enum")
 */
public function fooAction(BarType $barType) : Response
{
    //...   
}

Happy coding!

The Versions

27/07 2017