Symfony 2.6.4 - Doctrine、生成 Getters 和 Setters、RuntimeException 错误
Symfony 2.6.4 - Doctrine, Generating Getters and Setters, RuntimeException Error
完成后:$ 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;
}
所以我检查了所有内容是否有错别字,并用谷歌搜索了大约半小时,但没有看到这个错误是从哪里来的。有任何想法吗?谢谢:)
所以因为它说我的 post 主要是代码,所以我必须写更多的东西.. 但我应该告诉你更多什么?我喜欢蛋糕、咖啡和香烟! :)
找到问题了...
我的代码确实有一些错别字..我写了好几次 lenght 而不是 length..该死的,不容易看出来 ;)
谢谢你的帮助:)
完成后:$ 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;
}
所以我检查了所有内容是否有错别字,并用谷歌搜索了大约半小时,但没有看到这个错误是从哪里来的。有任何想法吗?谢谢:)
所以因为它说我的 post 主要是代码,所以我必须写更多的东西.. 但我应该告诉你更多什么?我喜欢蛋糕、咖啡和香烟! :)
找到问题了...
我的代码确实有一些错别字..我写了好几次 lenght 而不是 length..该死的,不容易看出来 ;)
谢谢你的帮助:)