Reputation: 1496
I have a basic controller where an object should be updated:
(I hardcoded the id for testing)
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class UserController extends Controller {
/**
* @Route("/lorem", name="ipsum")
*/
public function defaultAction(Request $request) {
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('AppBundle:Customer\Customer')->find(3);
if (!$user) {
throw $this->createNotFoundException(
'No user found for id 3'
);
}
// I cant access setter and getter from user object !
$user->setName('afsd');
$em->flush();
return $this->render(
'AppBundle:directoy:index.html.twig',
[]
);
}
}
When i want to use setter and getter on the user object, i cant.
Method setName() not found...
Anybody could imagine why?
Thanks and Greetings!
Upvotes: 0
Views: 221
Reputation: 1012
Do you really have the function? i.e the setName() function.
take a look at this http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html
alos post the exact exception that you get please.
Upvotes: 1