I want to get my form out of a Service, but whatever I do, it just won't work.
I have the service in the YML
services:
myservice:
class: AppBundle\Service\Myservice
arguments: ["@doctrine.orm.entity_manager","@form.factory"]
then in AppBudle\Service\Myserivce.php:
namespace AppBundle\Service;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class Myservice {
protected $em;
protected $formFactory;
public function __construct(EntityManager $entityManager, FormFactoryInterface $formFactory) {
$this->em = $entityManager;
$this->formFactory = $formFactory;
}
// GENERATE CALCULATOR FORM
public function generateCalculatorForm() {
return 'ffffsdsd';
}
}
But I get a
Catchable Fatal Error: Argument 2 passed to AppBundle\Service\Myservice::__construct() must be an instance of AppBundle\Service\FormFactoryInterface, instance of Symfony\Component\Form\FormFactory given, called in D:\xamp\htdocs\icp\var\cache\dev\appDevDebugProjectContainer.php on line 409 and defined
What is wrong here? I already tried almost everything i found on the web, but cant get this working.