1
Это мой первый вопрос о SO. У меня проблема с SonataAdminBundle. Everythink работает нормально, но вместо имени поля entity я получаю путь к сущности.Дерево меток меню SonataAdminBundle показывает путь сущности вместо имени объекта
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.admin.city" class="My\FrontendBundle\Admin\CityAdmin">
<tag name="sonata.admin" manager_type="orm" group="Dane" label="Miasta"/>
<argument />
<argument>My\FrontendBundle\Entity\City</argument>
<argument>SonataAdminBundle:CRUD</argument>
<call method="setTranslationDomain">
<argument>MyFrontendBundle</argument>
</call>
</service>
</services>
</container>
класс Php
namespace My\FrontendBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class CityAdmin extends Admin
{
protected $translationDomain = 'MyFrontendBundle';
//protected $baseRoutePattern = 'city';
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name', 'text', array('label' => 'City name'))
->add('population', 'number') //if no type is specified, SonataAdminBundle tries to guess it
;
}
// Fields to be shown on filter forms
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
;
}
// Fields to be shown on lists
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
->add('population','number')
;
}
}