eZ Platform Discussions

Controller requires that you provide a value for the "$view" argument


#1

Hello guys, happy to join the community, In fact I’m trying to create a form contact.

  1. Created a Contact Entity
  2. Created Contact FormType
  3. Created my ContactController, and it looks like this:
class ContactController extends Controller
{
    public function fullViewAction(ContentView $view)
    {
        $contact = new Contact();
        $form = $this->createForm(ContactType::class, $contact, array(
            "action" => $this->generateUrl("create_contact"),
            "csrf_protection" => false
        ));

        $view->addParameters([
            'form' => $form->createView(),
        ]);
        return $view;
    }
}
  1. Created under my Backoffice a contentType with the same fileds as my Contact Entity, that have contact as an identifier.
  2. Created my contact route:
    contact:
    path:     /contact
    defaults: { _controller: AppBundle:Contact:fullView' }

Unfortunately i’m getting this exception:

Controller “AppBundle\Controller\ContactController::fullViewAction()” requires that you provide a value for the “$view” argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.