2017 © Pedro Peláez
 

symfony-bundle value-object-form-bundle

image

shivoham/value-object-form-bundle

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

value-object-form-bundle

Usage

The Kebab model

class Kebab
{
    private $name;

    public function getName()
    {
        return $this->name;
    }

    public function getIdentity()
    {
        return [
            'name' => $this->name,
        ];
    }

    public function setIdentity(Identity $identity)
    {
        $this->name = $identity->name;
        // ...
    }
}

The "POPO" Kebab identifier

class Identity
{
    public $name;

    // ...
}

The Kebab identifier form

use AppBundle\Form\Type\KebabIdentifierType;
use AppBundle\Entity\Kebab;
use AppBundle\Entity\Kebab\Identity;

$this->createForm(KebabIdentifierType::CLASS, $kebab, [
    'object_accessor' => 'getIdentity',
    'object_mutator' => 'setIdentity',
    'value_object_class' => Identity::class
]);

The Versions