PHP code example of byscripts / static-entity-bundle

1. Go to this page and download the library: Download byscripts/static-entity-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

byscripts / static-entity-bundle example snippets




namespace AppBundle\StaticEntity;

use Byscripts\StaticEntity\StaticEntity;

class Civility extends StaticEntity
{
    private $name;
    private $shortName;

    public static function getDataSet()
    {
        return array(
            'mr' => array('name' => 'Mister', 'shortName' => 'Mr'),
            'mrs' => array('name' => 'Misses', 'shortName' => 'Mrs'),
        );
    }
}

$builder->add('civility', StaticEntityType, $parameters);

class MyController
{
    public function myAction(Civility $civility)
    {
        $name = $civility->getName();
    }
}