完成此操作后:$ 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;
}
所以我检查了所有的拼写错误,在谷歌上搜索了大约半个小时,没有发现这个错误是从哪里来的。有什么想法吗?谢谢:)
所以,因为它说我的帖子主要是代码,我必须写更多的东西。。但是我还应该告诉你什么呢?我喜欢蛋糕、咖啡和香烟!:)
遇到问题。。。
我的代码中确实有一些拼写错误。。我写了好几次length而不是length。。该死,不容易看到;)
无论如何,感谢您的帮助:)