Symfony 我可以在adminclass I';我在吗?
是否有任何方法可以获得RentalUnit类而不必通过另一个adminclass手动选择它,或者甚至有可能 我不知道,但我相信你可以做Symfony 我可以在adminclass I';我在吗?,symfony,sonata-admin,Symfony,Sonata Admin,是否有任何方法可以获得RentalUnit类而不必通过另一个adminclass手动选择它,或者甚至有可能 我不知道,但我相信你可以做$this->getSubject()或者类似的事情。你能说得更具体些吗?您正在使用RentalUnitAdmin,是否需要RentalUnit的新实例? // src/AdminBundle/Entity/RentalUnitAdmin.php protected function configureFormFields(FormMapper $formMapp
$this->getSubject()
或者类似的事情。你能说得更具体些吗?您正在使用RentalUnitAdmin
,是否需要RentalUnit
的新实例?
// 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',))
;
}