2017 © Pedro Peláez
 

symfony-bundle enum-bundle

Utility wrapper around PHP-enum

image

lamoda/enum-bundle

Utility wrapper around PHP-enum

  • Thursday, July 12, 2018
  • by scaytrase
  • Repository
  • 12 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Lamoda PHP Enum bundle

Utility wrapper for https://github.com/paillechat/php-enum, (*1)

Installation

Usage is as simple as, (*2)

composer require lamoda/enum-bundle:^1.0
// Kernel

public function registerBundles()
{
    // ...
    $bundles[] = new \Lamoda\EnumBundle\LamodaEnumBundle();
    // ...
}
# config.yml
lamoda_enum:
    dbal_types:
        # short example
        my_domain_enum: My\Domain\Enum
        # full example
        my_domain_enum_2: 
          class: My\Domain\Enum
          # identical strategy saves enum as its name as is, no conversion
          # lowercase strategy converts enum name to lowercase and vice versa on fetch
          strategy: identical    
class MyEntity
{
    /** @ORM\Column(type="my_domain_enum") */
    private $value;
}

This will enable conversion of value field from your enum, (*3)

The Versions