2017-05-09 29 views
0
// src/AdminBundle/Entity/RentalUnitAdmin.php 
protected function configureFormFields(FormMapper $formMapper) 
     { 
      $formMapper 
       ->add('name', 'text') 
       ->add('location', 'entity', array('class' => 'AppBundle:Location')) 
       ->add('rentalUnitPriceGroups', 'collection', array(
        'entry_type' => RentalUnitPriceGroupForm::class, 
        'entry_options' => array('rentalUnit' => $formMapper -> getFormBuilder() -> getData()), 
        'allow_add' => true, 
       )) 
       ->add('rentalCategory', 'entity', array('class' => 'AppBundle:RentalCategory', 
        'choice_label' => 'name',)) 
      ; 
     } 

是否有任何方法可以獲得RentalUnit類,而無需通過另一個adminclass手動選擇它,還是甚至有可能?我可以在我所在的管理類中找到一個類嗎?

+0

請問您能更具體嗎?你正在使用''RentalUnitAdmin''並想要一個''RentalUnit''的新實例? –

回答

0

不知道從我的頭頂,但我相信你可以做$this->getSubject()或沿着這些線。

相關問題