2

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.

4
  • 1
    Are you sure that this issue is related with the snippet of code you provided ? Commented Apr 19, 2013 at 6:48
  • It's the only change I made before it started throwing an error so I can't imagine it being anything else. Commented Apr 19, 2013 at 14:59
  • maybe setParent() and getParent() are reserved method? Commented Apr 19, 2013 at 15:17
  • Nope. Tried changing it to a different name and it still throws the error. Commented Apr 20, 2013 at 9:11

5 Answers 5

6

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.

1
  • 1
    Okay, this one did not really help me out. I had to restart php-fpm after every request to the server. What permanently solved the issue, was upgrading php from 5.4.17-1 to 5.4.17-2 (CentOS remi rpm releases). Unfortunately I don't know for sure whether upgrading php-fpm or upgrading apc solved the issue. Commented Jul 15, 2013 at 11:55
4

Restarting the server solved the problem for me.

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

1
  • 1
    Most likely it is caused by APC cache. Fixed to me with apache restart
    – venimus
    Commented Aug 11, 2014 at 14:39
1

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

1
  • 9
    I experienced the same error message, although Doctrine-Bundle is already on 1.2.*. But after restarting the web server, everything worked fine again. I guess it was an error in the opcode cache (I am using APC).
    – stollr
    Commented Jun 7, 2013 at 10:07
1

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.

0

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.