在Symony 2.3.0中,我可以使用以下命令创建实体和快捷方式表示法:
php app/console generate:doctrine:entity --entity=TravelTravelBundle:User
根据Symfony's Documentation,这创建了一个实体快捷方式,可以使用此函数在defaultcontroller中调用:
public function ReturnUserAction($Username)
{
$userobject = $this->getDoctrine()
->getRepository('TravelTravelBundle:User')
->findByusername($Username);
if($userobject != NULL) {
return $this->render('TravelTravelBundle:Default:User.html.twig',
array(
'username' => $userobject[0]->getUsername(),
'email' => $userobject[0]->getEmail(),
'fn' => $userobject[0]->getFn(),
'sn' => $userobject[0]->getSn(),
'password' => $userobject[0]->getPassword(),
)
);
}
if(!isset($userobject) || $userobject == NULL || $userobject == "") {
throw new NotFoundHttpException("The Username:\"$Username\" does not exist");
}
}
如果不删除当前实体并生成新实体,我如何将此实体的快捷符号更改为TravelTravel:Username
而不是TravelTravelUser
?