ReflectionException on a property that does not exist #6971

Closed
opened 2026-01-22 15:42:23 +01:00 by admin · 0 comments
Owner

Originally created by @MichaelBelgium on GitHub (May 2, 2022).

We have a local environment where everything works perfectly, on our production env we get this error from an entity:

[Mon May 02 13:50:13.487359 2022] [proxy_fcgi:error] [pid 1696830:tid 139982606198528] [client 178.119.159.55:56499] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught ReflectionException: Property Entity\\Loginmethode::$text does not exist in /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/persistence/src/Persistence/Mapping/RuntimeReflectionService.php:88\nStack trace:\n#0 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/persistence/src/Persistence/Mapping/RuntimeReflectionService.php(88): ReflectionProperty->__construct()\n#1 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(3872): Doctrine\\Persistence\\Mapping\\RuntimeReflectionService->getAccessibleProperty()\n#2 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1092): Doctrine\\ORM\\Mapping\\ClassMetadataInfo->getAccessibleProperty()\n#3 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(712): Doctrine\\ORM\\Mapping\\ClassMetadataInfo->wakeupReflection()\n#4 /home/vhosts/as-trans.kisp.be/Athe...'

Loginmethode entity:

<?php

namespace Entity;

use Doctrine\ORM\Mapping as ORM;
use Entity\Base\ManagedEntity;

/**
 * @ORM\Table(name="tbl_loginmethodes")
 * @ORM\Entity(repositoryClass="Entity\Repository\LoginmethodeRepository")
 */
class Loginmethode extends ManagedEntity
{
    public const ALLOWED_TYPES = ['login', 'register'];

    public function __construct(string $name, string $type) {
        $this->setName($name);
        $this->setType($type);
    }

    /**
     * @var string
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * @ORM\Column(name="naam", type="string", length=64, nullable=false)
     */
    private string $name;

    /**
     * @var string
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * @ORM\Column(name="type", type="string", length=32, nullable=false)
     */
    private string $type;

    /**
     * @var bool
     * @ORM\Column(name="is_actief_website", type="boolean", nullable=false)
     */
    private bool $isActiefWebsite;

    /**
     * @var bool
     * @ORM\Column(name="is_actief_athena", type="boolean", nullable=false)
     */
    private bool $isActiefAthena;

    /**
     * @return string
     */
    public function getName(): string {
        return $this->name;
    }

    /**
     * @param  string  $name
     */
    public function setName(string $name): void {
        $this->name = $name;
    }

    /**
     * @return string
     */
    public function getType(): string {
        return $this->type;
    }

    /**
     * @param  string  $type
     */
    public function setType(string $type): void {
        if (in_array($type, self::ALLOWED_TYPES)) {
            $this->type = $type;
        }
    }

    /**
     * @return bool
     */
    public function isActiefWebsite(): bool {
        return $this->isActiefWebsite;
    }

    /**
     * @param  bool  $isActiefWebsite
     */
    public function setIsActiefWebsite(bool $isActiefWebsite): void {
        $this->isActiefWebsite = $isActiefWebsite;
    }

    /**
     * @return bool
     */
    public function isActiefAthena(): bool {
        return $this->isActiefAthena;
    }

    /**
     * @param  bool  $isActiefAthena
     */
    public function setIsActiefAthena(bool $isActiefAthena): void {
        $this->isActiefAthena = $isActiefAthena;
    }
}

Is this cache related? On the production env we do use apcu cache

Originally created by @MichaelBelgium on GitHub (May 2, 2022). We have a local environment where everything works perfectly, on our production env we get this error from an entity: ``` [Mon May 02 13:50:13.487359 2022] [proxy_fcgi:error] [pid 1696830:tid 139982606198528] [client 178.119.159.55:56499] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught ReflectionException: Property Entity\\Loginmethode::$text does not exist in /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/persistence/src/Persistence/Mapping/RuntimeReflectionService.php:88\nStack trace:\n#0 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/persistence/src/Persistence/Mapping/RuntimeReflectionService.php(88): ReflectionProperty->__construct()\n#1 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(3872): Doctrine\\Persistence\\Mapping\\RuntimeReflectionService->getAccessibleProperty()\n#2 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1092): Doctrine\\ORM\\Mapping\\ClassMetadataInfo->getAccessibleProperty()\n#3 /home/vhosts/as-trans.kisp.be/Athenasoft/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(712): Doctrine\\ORM\\Mapping\\ClassMetadataInfo->wakeupReflection()\n#4 /home/vhosts/as-trans.kisp.be/Athe...' ``` Loginmethode entity: ```PHP <?php namespace Entity; use Doctrine\ORM\Mapping as ORM; use Entity\Base\ManagedEntity; /** * @ORM\Table(name="tbl_loginmethodes") * @ORM\Entity(repositoryClass="Entity\Repository\LoginmethodeRepository") */ class Loginmethode extends ManagedEntity { public const ALLOWED_TYPES = ['login', 'register']; public function __construct(string $name, string $type) { $this->setName($name); $this->setType($type); } /** * @var string * * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") * @ORM\Column(name="naam", type="string", length=64, nullable=false) */ private string $name; /** * @var string * * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") * @ORM\Column(name="type", type="string", length=32, nullable=false) */ private string $type; /** * @var bool * @ORM\Column(name="is_actief_website", type="boolean", nullable=false) */ private bool $isActiefWebsite; /** * @var bool * @ORM\Column(name="is_actief_athena", type="boolean", nullable=false) */ private bool $isActiefAthena; /** * @return string */ public function getName(): string { return $this->name; } /** * @param string $name */ public function setName(string $name): void { $this->name = $name; } /** * @return string */ public function getType(): string { return $this->type; } /** * @param string $type */ public function setType(string $type): void { if (in_array($type, self::ALLOWED_TYPES)) { $this->type = $type; } } /** * @return bool */ public function isActiefWebsite(): bool { return $this->isActiefWebsite; } /** * @param bool $isActiefWebsite */ public function setIsActiefWebsite(bool $isActiefWebsite): void { $this->isActiefWebsite = $isActiefWebsite; } /** * @return bool */ public function isActiefAthena(): bool { return $this->isActiefAthena; } /** * @param bool $isActiefAthena */ public function setIsActiefAthena(bool $isActiefAthena): void { $this->isActiefAthena = $isActiefAthena; } } ``` Is this cache related? On the production env we do use apcu cache
admin closed this issue 2026-01-22 15:42:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6971