symfony找到该文件,但该类不在其中

时间:2017-03-16 02:47:38

标签: php symfony

当我在终端上运行此命令时

join

我收到此错误

php app/console doctrine:schema:validate

我使用symfony 2.8和我的代码就像示例页面一样,这是错误的吗?

product.php文件代码

  The autoloader expected class "tuto\testBundle\Entity\product" to be defined in file "../src/tuto/testBundle/Entity/product.php". The file was found but the class was not in it, the class name or names  
  pace probably has a typo.                                                                                 

和product.orm.yml文件

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


/**
 * @ORM\Entity
 * @ORM\Table(name="product")
 */
class product 
{


  /** 
  *@ORM\Column(type="integer")
  *@ORM\Id
  *@ORM\GeneratedValue(strategy="AUTO")  
  */


  private $id;
  /** @ORM\Column(length=140) */




  public function getUserId(){
    return $this->UserId;
  }
  public function setUserId($id){
    return $this->UserId=$id;
  }
}

1 个答案:

答案 0 :(得分:5)

您需要将您的班级名称大写:

class Product

参见symfony编码标准here。具体来说,PSR-1指定使用StudlyCaps作为类名。