Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2425

Parent entity sometimes fails to load when validating/updating schema.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
    • Environment:
      Debian 6.0.6 x64

      Description

      Should not have reported, was a stupid mistake on my part.

        Activity

        Scott Gibson created issue -
        Scott Gibson made changes -
        Field Original Value New Value
        Description It appears as though the ClassLoader is intermittently failing while running the schema-tool. I likely have 30-50 entities setup in this application and they all work fine, except for this one... It's likely I've missed something obvious, but this just makes no sense to me.

        REPRODUCTION STEPS
        Class A is the top-level entity of an inheritance hierarchy. Class B and C extend A.

        Running orm:schema-tool:update --force throws this error:
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.

        If I remove B from the directory, A and C work fine. If I add require("/path/to/A") to the top of B, it works.

        {code}
        // MyProject/Entities/A.php
        namespace MyProject\Entities;

        /**
         * @Entity
         * @Table(name="MyProject_A")
         * @InheritanceType("SINGLE_TABLE")
         * @DiscriminatorColumn(name="discr", type="string")
         * @DiscriminatorMap({ "a" = "A", "b" = "B", "c" = "C" })
         */
        class A extends EntityAbstract
        {}

        -----------------------------

        // MyProject/Entities/B.php
        namespace MyProject\Entities;

        require("/path/to/A"); //<-- hack to fix

        /**
         * @Entity
         */
        class B extends A
        {}

        -----------------------------

        // MyProject/Entities/C.php
        namespace MyProject\Entities;

        // no hack required here

        /**
         * @Entity
         */
        class C extends A
        {}
        {code}

        // command line
        docrine orm:schema-tool:update --force

        // result
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.
        It appears as though the ClassLoader is intermittently failing while running the schema-tool. I likely have 30-50 entities setup in this application and they all work fine, except for this one... It's likely I've missed something obvious, but this just makes no sense to me.

        REPRODUCTION STEPS
        Class A is the top-level entity of an inheritance hierarchy. Class B and C extend A.

        Running orm:schema-tool:update --force throws this error:
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.

        If I remove B from the directory, A and C work fine. If I add require("/path/to/A") to the top of B, it works.

        {code}
        // MyProject/Entities/A.php
        namespace MyProject\Entities;

        /**
         * @Entity
         * @Table(name="MyProject_A")
         * @InheritanceType("SINGLE_TABLE")
         * @DiscriminatorColumn(name="discr", type="string")
         * @DiscriminatorMap({ "a" = "A", "b" = "B", "c" = "C" })
         */
        class A extends EntityAbstract
        {}

        -----------------------------

        // MyProject/Entities/B.php
        namespace MyProject\Entities;

        require("/path/to/A"); //<-- hack to fix

        /**
         * @Entity
         */
        class B extends A
        {}

        -----------------------------

        // MyProject/Entities/C.php
        namespace MyProject\Entities;

        // no hack required here

        /**
         * @Entity
         */
        class C extends A
        {}
        {code}

        // command line
        doctrine orm:schema-tool:update --force

        // result
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.
        Scott Gibson made changes -
        Priority Blocker [ 1 ] Critical [ 2 ]
        Scott Gibson made changes -
        Affects Version/s 2.3.3 [ 10329 ]
        Description It appears as though the ClassLoader is intermittently failing while running the schema-tool. I likely have 30-50 entities setup in this application and they all work fine, except for this one... It's likely I've missed something obvious, but this just makes no sense to me.

        REPRODUCTION STEPS
        Class A is the top-level entity of an inheritance hierarchy. Class B and C extend A.

        Running orm:schema-tool:update --force throws this error:
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.

        If I remove B from the directory, A and C work fine. If I add require("/path/to/A") to the top of B, it works.

        {code}
        // MyProject/Entities/A.php
        namespace MyProject\Entities;

        /**
         * @Entity
         * @Table(name="MyProject_A")
         * @InheritanceType("SINGLE_TABLE")
         * @DiscriminatorColumn(name="discr", type="string")
         * @DiscriminatorMap({ "a" = "A", "b" = "B", "c" = "C" })
         */
        class A extends EntityAbstract
        {}

        -----------------------------

        // MyProject/Entities/B.php
        namespace MyProject\Entities;

        require("/path/to/A"); //<-- hack to fix

        /**
         * @Entity
         */
        class B extends A
        {}

        -----------------------------

        // MyProject/Entities/C.php
        namespace MyProject\Entities;

        // no hack required here

        /**
         * @Entity
         */
        class C extends A
        {}
        {code}

        // command line
        doctrine orm:schema-tool:update --force

        // result
        PHP Fatal error: Class 'A' not found in /path/to/B on line 10.
        Should not have reported, was a stupid mistake on my part.
        Priority Critical [ 2 ] Trivial [ 5 ]
        Component/s ORM [ 10012 ]
        Component/s Tools [ 10015 ]
        Component/s Mapping Drivers [ 10044 ]
        Scott Gibson made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2425, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Scott Gibson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: