1.annotation定义路由
@Route("/**",defaults={"name":"world"},requirements={"name"="s"}) 参数要用双引号,不能用单引号。
2.执行命令php app/console doctrine:generate:entities CaiganBundle 报错的原因是 Entity类中ORM后面不能用“/”,要用“”;并且括号中的参数一定要用双引号,不能用单引号https://stackoverflow.com/questions/26803213/the-annotation-doctrine-orm-mapping-in-class-xx-does-not-exist-or-cannot-be-lo
<?php
namespace CaiganBundleEntity;
use DoctrineORMMapping as ORM;
/**
* Class User
* @package CaiganBundleEntity
* @ORMEntity(repositoryClass="UserRepository")
* @ORMTable(name="user")
*/
class User
{
/**
* @ORMId //不能用“/”,要用“”
* @ORMColumn(type="integer",length=10)//双引号
* @ORMGeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORMColumn(type="string",length=32)
*/
protected $username;
/**
* @ORMColumn(type="string",length=32)
*/
protected $password;
}