[英]Error generating entity with Symfony2
I am generating an Entity from php Class:我正在从 php 类生成一个实体:
<?php
// src/Printing/Productesbundle/Entity/User.php
namespace Printing\ProductesBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="UsersStamp")
*/
class UserStamp
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
}
?>
When I execute当我执行
php app/console doctrine:generate:entities Printing/ProductesBundle/Entity/UserStamp
it returns me the following error它返回给我以下错误
[Doctrine\ORM\Mapping\MappingException]
Class "Printing\ProductesBundle\Entity\UserStamp" is not a valid entity or mapped super class.
What am i missing??我错过了什么??
Thank you!谢谢!
PS: PS:
That's my Doctrine Configuration:这是我的学说配置:
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
你能试试下面的命令吗?
app/console doctrine:generate:entities PrintingProductesBundle:UserStamp
After trying some tricks I found the solution.在尝试了一些技巧后,我找到了解决方案。
I guess the error radicates on the fact that I have entities generated previously from database.我猜这个错误表明我以前从数据库中生成了实体。
To solve this question, you have to remove the content of the config/doctrine folder.要解决这个问题,您必须删除 config/doctrine 文件夹的内容。
Thanks to @Javad to keep trying!感谢@Javad 继续努力!
I think you need to execute something like this我认为你需要执行这样的事情
php app/console doctrine:generate:entities ProductesBundle
php 应用程序/控制台学说:生成:实体 ProductesBundle
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.