dt2002 2015-02-18 18:22
浏览 40
已采纳

Symfony 2.6.4 - Doctrine,生成Getter和Setter,RuntimeException错误

After doing this: $ php app/console doctrine:generate:entities AppBundle/Entity/Item

I'm getting this error:

[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.

This is my entity file:

// 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;
}

So I checked everything for a typo, and googled for about half an hour, and don't see where this error comes from. Any ideas? Thanks :)

So because it's saying my post is mostly code, I have to write something more.. but what should I tell you more? I like cake, coffee and cigarettes! :)

  • 写回答

1条回答 默认 最新

  • douli4852 2015-02-22 00:24
    关注

    got the problem...

    I indeed had some typos in my code.. I wrote lenght instead of length several times.. damn, not easy to see ;)

    Thanks for your help anyways :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题
  • ¥15 有没有人能解决下这个问题吗,本人不会编程
  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗