Doctrine Common
  1. Doctrine Common
  2. DCOM-94

Support for constants on annotation reader

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: Annotations
    • Labels:
      None

      Description

      Would be nice get support for constants on annotation reader.

      Usage :

      /**
      * @SomeAnnotation(PHP_EOL)
      * @SomeAnnotation(SomeClass::SOME_VALUE)
      * @SomeAnnotation({SomeClass::VALUE1,SomeClass::VALUE2})
      * @SomeAnnotation({SomeClass::SOME_KEY = SomeClass::SOME_VALUE})
      */
      

        Activity

        Show
        Fabio B. Silva added a comment - Fixed : https://github.com/doctrine/common/commit/970912eec0a1371e03de7010556d9280c26d8083
        Hide
        Fabio B. Silva added a comment -

        hello gabriel,

        I have a pull request opened : https://github.com/doctrine/common/pull/104

        feel free to join us and comment ...
        in inglesh please

        Show
        Fabio B. Silva added a comment - hello gabriel, I have a pull request opened : https://github.com/doctrine/common/pull/104 feel free to join us and comment ... in inglesh please
        Hide
        gabriel sancho added a comment -

        file doctrine-2.2.0/Doctrine/Common/Lexer.php
        line 214
        @patch : para poder usar constantes

        • definidas con define como param de las anotaciones
        • las constantes deben empesar por '_' para evitar conflictos con 'false' y 'true'
        • esto solo soporta constantes en los valores de las anotaciones
        • ej:

        define('_db_clase_05', '"test.Clase_05"');
        ...
        /** @Table(name=_db_clase_05)
        ... */
        class Clase_05

        { ... }

        if(is_string($match[0]) && ($match[0][0] == '_') && defined($match[0]))

        { $aux_val = constant($match[0]); $match[0] = $aux_val; }
        Show
        gabriel sancho added a comment - file doctrine-2.2.0/Doctrine/Common/Lexer.php line 214 @patch : para poder usar constantes definidas con define como param de las anotaciones las constantes deben empesar por '_' para evitar conflictos con 'false' y 'true' esto solo soporta constantes en los valores de las anotaciones ej: define('_db_clase_05', '"test.Clase_05"'); ... /** @Table(name=_db_clase_05) ... */ class Clase_05 { ... } if(is_string($match [0] ) && ($match [0] [0] == '_') && defined($match [0] )) { $aux_val = constant($match[0]); $match[0] = $aux_val; }

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Fabio B. Silva
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: