/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($builder->getForm()->getName() == CustomEntityType::NAME) { return; } $className = !empty($options['data_class']) ? $options['data_class'] : null; if (!$className) { return; } if (!$this->extendManager->getConfigProvider()->hasConfig($className)) { return; } if (!$this->hasActiveFields($className)) { return; } $builder->add('additional', CustomEntityType::NAME, array('inherit_data' => true, 'class_name' => $className)); }
/** * @param $entity * @return bool */ public function isExtendEntity($entity) { return $this->extendManager->isExtend($entity); }
/** * @param ExtendManager $extendManager */ public function __construct(ExtendManager $extendManager) { $this->extendConfigProvider = $extendManager->getConfigProvider(); $this->extendManager = $extendManager; }