Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-385

Change behaviour if fully qualified classname is passed in as string

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-BETA4
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      If one calls $em->getRepository('\Entity') (leading \ !) then Doctrine's behaviour is quite undefined, as it would result e.g. in a "mapping file '.entity.dcm.yml' not found" error. (leading dot!)

      PHP, however, seems to allow the leading \, but Doctrine does not. In fact, the leading \ is not necessary as classnames in strings are always fully qualified.

      So Doctrine should either:

      1.) Throw an exception stating that using a leading backslash is prohibited
      2.) Simply strip it.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        I vote for 1. Stripping the char just leads to major overhead given that getMetadataFor is one of the most called functions in Doctrine 2.

        Show
        Benjamin Eberlei added a comment - I vote for 1. Stripping the char just leads to major overhead given that getMetadataFor is one of the most called functions in Doctrine 2.
        Hide
        Roman S. Borschel added a comment -

        Fixed.

        Show
        Roman S. Borschel added a comment - Fixed.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Christian Heinrich
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: