Doctrine 1
  1. Doctrine 1
  2. DC-229

Doctrine::getInstance()->setImpl($template, $class) has no effect

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.2.0-BETA2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      WAMP (W XP, A 2.2.11, M 5.1.36, P 5.2.6), Zend Framework 1.9.5, Doctrine 1.2.0-BETA2

      Description

      When defining a schema such as

         Schema
         --
      
         Something:
           columns:
             id:
               type: integer(4)
               autoincrement: true
               primary: true
           actAs:
             XyzCodable:
      

      and then attempting to set an implementation such as

        Doctrine_Manager::getInstance()->setImpl('XyzCodable', 'Wurst_Doctrine_Template_XyzCodable');
      

      no effect on the generated base models can be observed. In the generated models, instances of the class

        XyzCodable
      

      are attempted to be created, which, however, does not exist.

      When defining a schema such as

         Schema
         --
      
         Something:
           columns:
             id:
               type: integer(4)
               autoincrement: true
               primary: true
           actAs:
             Wurst_Doctrine_Template_XyzCodable:
      

      the corresponding base model is generated just fine, however, while processing

        Doctrine_Core::generateModelsFromYaml($schemaPath, $modelsPath, $options);
      

      a PHP warning such as

         Warning: include(Doctrine\Template\Wurst\Doctrine\Template\XyzCodable.php) [function.include]:    failed to open stream: No such file or directory in F:\public\wurst\local\zf\library\Zend\Loader.php on line 83
      
         Warning: include() [function.include]: Failed opening 'Doctrine\Template\Wurst\Doctrine\Template\XyzCodable.php for inclusion 
        (include_path='F:\public\wurst\local\zf\public\..\application\../library/Minify;F:\public\wurst\local\zf\public\..\application\../library/Doctrine;F:\public\ao\local\zf\public\..\application\..\library;.;C:\php5\pear') 
      

      is produced.

      I believe that this issue should be fixed, as custom templates and behaviours should not necessarily reside in the Doctrine namespace, especially not when updating via SVN.

        Activity

        Hide
        Jonathan H. Wage added a comment -

        I think you are not understanding correctly. You are not using this correctly.

        Doctrine_Manager::getInstance()->setImpl('XyzCodable', 'Wurst_Doctrine_Template_XyzCodable');
        

        Go back to the documentation and read what setImpl() is for. The class name "Wurst_Doctrine_Template_XyzCodable" is fine, your Zend autoloader should be configured to not throw fatal errors. Be sure that one of your autoloaders can autoload the class "Wurst_Doctrine_Template_XyzCodable"

        Show
        Jonathan H. Wage added a comment - I think you are not understanding correctly. You are not using this correctly. Doctrine_Manager::getInstance()->setImpl('XyzCodable', 'Wurst_Doctrine_Template_XyzCodable'); Go back to the documentation and read what setImpl() is for. The class name "Wurst_Doctrine_Template_XyzCodable" is fine, your Zend autoloader should be configured to not throw fatal errors. Be sure that one of your autoloaders can autoload the class "Wurst_Doctrine_Template_XyzCodable"
        Hide
        Christian Schmitz added a comment -

        Sorry Jonathan, but i can't agree with that.

        The documentation at http://www.doctrine-project.org/Doctrine_Configurable/1_1#method_setimpl says: "setImpl binds given class to given template name"

        So, the following stuff should work, but doesn't:

        Doctrine_Manager::getInstance()->setImpl('XyzCodable', 'Wurst_Doctrine_Template_XyzCodable');
        

        At the schema:

        actAs:
           XyzCodable:
        

        The base models still generate instances of XyzCodable.

        Should i really have to define "Wurst_Doctrine_Template_XyzCodable" at the schema?

        Show
        Christian Schmitz added a comment - Sorry Jonathan, but i can't agree with that. The documentation at http://www.doctrine-project.org/Doctrine_Configurable/1_1#method_setimpl says: "setImpl binds given class to given template name" So, the following stuff should work, but doesn't: Doctrine_Manager::getInstance()->setImpl('XyzCodable', 'Wurst_Doctrine_Template_XyzCodable'); At the schema: actAs: XyzCodable: The base models still generate instances of XyzCodable. Should i really have to define "Wurst_Doctrine_Template_XyzCodable" at the schema?

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Andreas Möller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: