Search code examples
symfonysymfony-3.3symfony2-easyadmineasyadmin

How do you show value as a title in easyadmin bundle?


in config.yml

edit:
                title:  'editing %firstname% '
                fields:
                    - {property: firstname, type: string}
                    - {property: lastname, type: string}
                    - {property: email, type: string}
                    - {property: password,type: password}
                    - {property: mobilenumber, type: string}
                    - enabled

i want the username to come up dynamically and %firstname% doesn't work.


Solution

  • You can only display entity ID in edit view like this:

    title: 'editing %%entity_id%%'
    

    Starting from there, you can use Doctrine composite primary key to include firstname (or username?) in your primary key on User class:

    /** @ORM\Id @ORM\Column(type="string") */
    private $username;