简体   繁体   English

symfony2:无法重新声明类

[英]symfony2: cannot redeclare class

Im getting this error message when I try to create the schema: 我在尝试创建架构时收到此错误消息:

Error message: PHP Fatal error:  Cannot redeclare class Trans in /home/tirengarfio/workspace/sermovi/src/CanalonesBastimar/Bundle/ManagementBundle/Entity/Trans.php on line 3

Customer.php: Customer.php:

/**
 * @ORM\OneToMany(targetEntity="CanalonesBastimar\Bundle\ManagementBundle\Entity\Trans", mappedBy="customer")
 */
private $customers;

Trans.php: Trans.php:

<?php

class Trans {

}

I have only one time declare as far as I know: I search into the project and there is only one declaration.. I also cleared the cache. 据我所知,我只有一次声明:我搜索该项目,只有一个声明..我还清除了缓存。

NOTE: even if I change the class name inside Trans.php , I get the same error but related to the new name. 注意:即使我更改了Trans.php的类名, Trans.php遇到相同的错误,但与新名称有关。

Your are missing the namespace definition in your trans class. 您在trans类中缺少名称空间定义。 Eg: 例如:

<?php

namespace CanalonesBastimar\ManagementBundle\Entity;

class Trans {

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM