2012-10-18 78 views
1

我正在尋找重寫BaseMediaBundle來自定義例如函數「configureListFields」。用sonata覆蓋BaseMediaAdminMediaBundle

我已經覆蓋了這個包的控制器,但不是BaseMediaAdmin。

此代碼的問題是實體「媒體」我的儀表板disapear!

//在我的services.xml:

<service id="sonata.media.admin.media" class="Application\Sonata\MediaBundle\Admin\MediaAdmin"> 
     <tag name="sonata.media.admin" manager_type="orm" group="Gestion des médias" 
      label="Média" /> 
     <argument /> 
     <argument>Application\Sonata\MediaBundle\Entity\Media</argument> 
     <argument>Application\SonataMediaBundle:MediaAdmin</argument> 
     <call method="setTranslationDomain"> 
      <argument>SonataMediaBundle</argument> 
     </call> 
    </service> 

//我的應用程序\索納塔\ MediaBundle \管理\ MediaAdmin

namespace Application\Sonata\MediaBundle\Admin; 

use Sonata\AdminBundle\Admin\Admin; 
use Sonata\AdminBundle\Form\FormMapper; 
use Sonata\AdminBundle\Datagrid\DatagridMapper; 
use Sonata\AdminBundle\Datagrid\ListMapper; 
use Sonata\AdminBundle\Show\ShowMapper; 
use Sonata\AdminBundle\Route\RouteCollection; 
use Sonata\MediaBundle\Provider\Pool; 
use Sonata\MediaBundle\Form\DataTransformer\ProviderDataTransformer; 

use Knp\Menu\ItemInterface as MenuItemInterface; 

use Sonata\MediaBundle\Admin\BaseMediaAdmin as BaseMediaAdmin; 


class MediaAdmin extends BaseMediaAdmin 
{ 

    /** 
    * {@inheritdoc} 
    */ 
    protected function configureListFields(ListMapper $listMapper) 
    { 
     $listMapper 
//   ->add('image', 'string', array('template' => 'SonataMediaBundle:MediaAdmin:list_image.html.twig')) 
      ->add('custom', 'string', array('template' => 'SonataMediaBundle:MediaAdmin:list_custom.html.twig')) 
      ->add('enabled', 'boolean', array('editable' => true)) 
      ->add('_action', 'actions', array(
       'actions' => array(
        'view' => array(), 
        'edit' => array(), 
        'delete' => array(), 
       ) 
      )) 
     ; 
    } 

} 

如果有人有想法? Thx尋求幫助

+0

沒有人遇到同樣的問題嗎? – psylo66

+0

我得到同樣的問題。 –

回答