Symfony2 Blad w Register Action

0

Witam mam problem Robie Rejstracje uzytkownika i mam problem Mam taki blad:
An exception occurred while executing 'INSERT INTO users (username, email, password) VALUES (?, ?, ?)' with params [null, "login@o2.pl", "haslo"]:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'BlogDB.users' doesn't exist

Kod:

 public function registerAction(Request $request)
    {
        $user = new User();
        $username = $request->get('name');
        $password = $request->get('password');
        $email = $request->get('email');
        
        $user->setUsername($username);
        $user->setPassword($password);
        $user->setEmail($email);
        
        $button = $request->get('registerBtn');
        
        $em = $this->getDoctrine()->getManager();
        
        if(isset($button))
        {
            $em->persist($user);
            $em->flush();
            
            return $this->render('BlogBundle:Blog:registrationSuccessful.html.twig');
        }
        
        return array();
    } 
0

Mysle ze chodzi tu o parametr ID ktory jest nullem ale nie rozumiem dlaczego poniewaz z encji mam :
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;

0

Nie nazywaj tego Symfony2, bo to jest co najwyżej jakaś jego kiepska parodia. Poczytaj w dokumentacji jak powinno się tworzyć użytkowników / obsługiwać formularze. Pomijając już fakt, że masz np. FOSUserBundle, który zrobi prawie wszystko za Ciebie w tym zakresie.

0
Mały Orzeł napisał(a):

Table 'BlogDB.users' doesn't exist

A masz taką tabelę w bazie? Jak nie to zacznij od tego w jaki sposób ją wygenerować na podstawie encji.

1 użytkowników online, w tym zalogowanych: 0, gości: 1