执行此操作后:$ php app/console doctrine:generate:entities AppBundle/Entity/Item
我收到了这个错误:
[RuntimeException]
The autoloader expected class "AppBundle\Entity\Item" to be defined in file "/home/user/symfony-projects/demo/src/AppBundle/Entity/Item.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
这是我的实体档案:
// src/AppBundle/Entity/Item.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="item")
*/
class Item
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=128)
*/
protected $title;
/**
* @ORM\Column(type="integer")
*/
protected $userid;
/**
* @ORM\Column(type="datetime")
*/
protected $created;
/**
* @ORM\Column(type="string", lenght=64)
*/
protected $type;
/**
* @ORM\Column(type="string", lenght=64)
*/
protected $category;
/**
* @ORM\Column(type="string", lenght=64)
*/
protected $subcategory;
/**
* @ORM\Column(type="string", lenght=64)
*/
protected $location;
/**
* @ORM\Column(type="text")
*/
protected $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $image;
}
所以我检查了所有的拼写错误,并用Google搜索了大约半小时,并没有看到这个错误来自哪里。有任何想法吗?谢谢:))
因为它说我的帖子主要是代码,我必须写更多内容......但是我应该告诉你更多什么?我喜欢蛋糕,咖啡和香烟! :)
答案 0 :(得分:0)
遇到问题......
我的代码中确实有一些拼写错误。我写了几次而不是长度...该死的,不容易看到;)
感谢您的帮助,无论如何:)