Почему не срабатывает автосвязывание метода?

собсвенно вот services.yaml
App\Dictionary\Validator\Fabric\Commands\CommandEntities:
        calls:
            - [setFetcher, ['@App\Dictionary\View\AbstractDictionaryFetcher']]

вот так использую в классе

private ?AbstractDictionaryFetcher $fetcher = null;

    public function setFetcher(AbstractDictionaryFetcher $fetcher): void
    {
        $this->fetcher = $fetcher;
    }


    public function validate($content,array $options =[]): bool
    {
        try{
            new Uuid($content);
            if(!array_key_exists(self::TABLE_NAME, $options)){
                $this->message = "related entity is not installed in dictionary field";
                return false;
            }
            if(!$this->fetcher->isHaveRow($options[self::TABLE_NAME],$content)){
                $this->message = "related entity  not found";
                return false;
            }
            return true;
        }catch (\InvalidArgumentException $e){
            $this->message = $e->getMessage();
            return false;
        }
    }

вызываю его таким образом
new $returnCommand;
где $returnCommand = App\Dictionary\Validator\Fabric\Commands\CommandEntities
но при вызове метода

$returnCommand ->validate($content, $options)
получаю ошибку
Call to a member function isHaveRow() on null

Почему, что я делаю не так и как правильно?
  • Вопрос задан
  • 91 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы