문제

I created an admin interface using sonatadminbundle, it works fine & can add items & display them, but I also need to display the item id set by default (set as auto-increment) in the admin interface, how can I do that? admin dahsboard

도움이 되었습니까?

해결책

you can do that using the __toString() method in the Entity (in your example Category) like:

function __toString()
{
    return $this->getId().' - '.$this->getName();
}

다른 팁

Add id in $listMapper in your Acme/DemoBundle/Admin/somethingAdmin.php file:

protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('name')
            ->add('id')
        ;
    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top