我有一个非常奇怪的错误:
Fatal error: Access level to Acme\DemoBundle\Entity\Book::$title
must be public (as in class Acme\DemoBundle\Entity\AbstractBook) in
/var/www/html/src/Acme/DemoBundle/Entity/Book.php on line 614 Call
Stack: 0.0002 674960 1
第 614 行不可用,最疯狂的是,当我将整个实体文件夹从 ide 手动上传到本地 ubunutu 映像时,错误就消失了。
这是我的 AbstractBookEntity:
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\MappedSuperclass
* @ORM\HasLifecycleCallbacks
*/
class AbstractBook
{
/**
* @var string $title
*
* @ORM\Column(name="title", type="string", length=45, nullable=true)
*/
public $title;
图书类:
namespace Acme\DemoBundle\Entity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
/**
* Acme\DemoBundle\Entity\Book
*
* @ORM\Table(name="book")
* @ORM\Entity(repositoryClass="Acme\DemoBundle\Repository\BookRepository")
*/
class Book extends AbstractBook {
更新:
我检测到抽象实体中的属性被复制并声明为私有到扩展实体中,但它是如何发生的?