2

私はsymfony2とFOSUserBundleを使用しています

ProfileController で「createFormBuilder」を使用したい

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Symfony\Component\HttpFoundation\Response;
use Acme\UserBundle\Entity\AttrMutor;


class ProfileController extends ContainerAware
{
      $attrMutor = new AttrMutor();
      $form = $this->createFormBuilder($attrMutor);    

のように示します

FatalErrorException: Error: Call to undefined method Acme\UserBundle\Controller\ProfileController::createFormBuilder() 

どうすればこれを解決できますか?

$this->createFormBuilder などの他のコントローラーで使用できます

class DefaultController extends Controller
{
      $attrMutor = new AttrMutor();
      $form = $this->createFormBuilder($attrMutor);   //OK

extends ContainerAware と extends Controller の違いにヒントがあると思います

4

1 に答える 1