im fairly new to Mac and Symfony in general so sorry if im missing any basic knowledge
basically trying to create a form using a php class, here its below
<?php
namespace TeamRock\ApplicationBundle\entity;
class Person{
protected $email;
protected $fullname;
public function getEmail(){
return $this->$email;
}
public function setEmail($email){
return $this->$email;
}
public function getFullname(){
return $this ->$fullname;
}
public function setFullname($fullname){
return $this -> $fullname;
}
}
?>
i then have my class
<?php
namespace TeamRock\ApplicationBundle\form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class personType extends AbstractType{
public function buildForm(FormBuilderInterface $builder, array $options){
$builder->add ('email','email')->add ('name','text')->add('submit','submit');
}
public function getName(){
return 'person';
}
}
?>
and then on the main controller
<?php
namespace TeamRock\ApplicationBundle\Controllers\Calvin;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use TeamRock\ApplicationBundle\entity\Person;
use TeamRock\ApplicationBundle\form\PersonType;
class Homepage
{
public function __invoke(Request $request)
{
$person = new person();
$form = $this->createForm(new PersonType(), $person);
return new Response("Hello, world!", Response::HTTP_OK, array('form'=>$form->createView()));
}
}
?>
And the error i keep getting is
Attempted to call method "createForm" on class "TeamRock\ApplicationBundle\Controllers\Calvin\Homepage".
500 Internal Server Error - UndefinedMethodException
Any help is appreciated guys, as i said im pretty new to php and symfony and its a big learning curve so any helps or pointers are appreciated
ive been watching this guys videos just for reference Andrew Perkins Symfony Tutorials
thanks again for any help in advance!