Dostep do entity menagera w formie

<?php

namespace App\Utils\Campaign;

use App\Lib\CrudManager\Form\FilterDtoType as BaseFilterDtoType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use App\DTO\Campaign\CampaignFilterDTO;
use Symfony\Component\Form\CallbackTransformer;
use App\Repository\TagProduct\TagProductRepository;
use App\Domain\Tags\ProductTagsProvider;

class FilterType extends BaseFilterDtoType{
    const TRANSLATE_PREFIX = 'campaign.filter.';
    
    protected $productTagProvider;

    public function __construct(ProductTagsProvider $productTagProvider)
    {
        $this->productTagProvider = $productTagProvider;
    }

    public function buildForm(FormBuilderInterface $builder, array $options) {
        parent::buildForm($builder, $options);
        /** @var \Doctrine\ORM\EntityManager $entityManager */
        $entityManager = $options['entity_manager'];
    }

    public function configureOptions(OptionsResolver $resolver) {
        //$resolver->setRequired('entity_manager');
        $resolver->setDefaults(array(
            'data_class' => CampaignFilterDTO::class,
            'csrf_protection' => false,
            'allow_extra_fields' => true,
            'entity_manager' => true,
        ));
    }

    public function getBlockPrefix() {
        return 'campaign_filter';
    }
}
Komentarze wyłączone