MARKER constant override Symfony2 error

2019-04-14 01:04发布

So, I have a categories entity set up with a parent_id being self-references. But for some reason when I save the entry in the form I get this error.

Fatal error: Cannot inherit previously-inherited or override constant MARKER from interface Doctrine\Common\Persistence\Proxy in /var/www/html/project/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/Proxy.php on line 30

Can't figure out what it might be. I set the relationship up according to the Doctrine documentation.

/**
 * Set parent
 *
 * @param string $parent
 * @return Category
 */
public function setParent($parent)
{
    $this->parent = $parent;

    return $this;
}

/**
 * Get parent
 *
 * @return string 
 */
public function getParent()
{
    return $this->parent;
}

Any help would be much appreciated.

5条回答
我命由我不由天
2楼-- · 2019-04-14 01:24

Restarting the server solved the problem for me.

(Using PHP 5.4.15, APC 3.1.13, Apache2.4.4, Doctrine2.2)

查看更多
聊天终结者
3楼-- · 2019-04-14 01:28

I have also encountered this problem with php-fpm 5.4.19, nginx 1.4 and APC 3.1.15 (?) on Centos6-64. As Mark was also mentioning, the use of the Remi repository which I used as well. It seems like the 3.1.15 isn't officially released yet. There isn't even a tag for it on the pecl page! It looks like Remi was trying to fix something to get it work and named it 3.1.15, but can't figure out exactly what it was that he was trying to fix.

Anyway I yum removed the package and installed the current release with the pecl command (now @ 3.1.13), which resolved my problem.

查看更多
放我归山
4楼-- · 2019-04-14 01:40

Apparently it was a bug in Doctrine-bundle. Updating it to version 1.2.* (and subsequently updating dependent packages) fixed the issue.

查看更多
成全新的幸福
5楼-- · 2019-04-14 01:47

I encountered the exact same problem today after doing a change that should not affect Doctrine in any way (I altered a Twig template). After some time I realized that since it's a strange compile error on a strange moment, probably restarting php-fpm would do the trick. And it did.

Maybe restarting Apache does the same if you're on mod_php.

查看更多
爷、活的狠高调
6楼-- · 2019-04-14 01:47

Please understand that APC is dead, unmaintained, no stable version exists for PHP 5.4 (or greater).

I recommend you to switch to:

  • opcache (php-pecl-zendopcache) for opcode cache
  • APCu (php-pecl-apcu) for user data cache (which provides the same API than the old APC, without opcode cache)
查看更多
登录 后发表回答