symfony 踩坑之旅 視頻實操從第九章開始

1.annotation定義路由php

@Route("/**",defaults={"name":"world"},requirements={"name"="\s"})  參數要用雙引號,不能用單引號。app

 

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-loui

<?php
namespace CaiganBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

/**
* Class User
* @package CaiganBundle\Entity
* @ORM\Entity(repositoryClass="UserRepository")
* @ORM\Table(name="user")
*/
class User
{
/**
* @ORM\Id //不能用「/」,要用「\」
* @ORM\Column(type="integer",length=10)//雙引號
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string",length=32) */ protected $username; /** * @ORM\Column(type="string",length=32) */ protected $password;}
相關文章
相關標籤/搜索