Doctrine 1
  1. Doctrine 1
  2. DC-801

Multiple template implementation (setImpl)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Behaviors
    • Labels:
      None

      Description

      I feel curios when looking setImpl code on Doctrine. It set like this:

      public function setImpl($template, $class)
      {
          $this->_impl[$template] = $class;
      
          return $this;
      }
      

      I've made a template:

      class PersonTemplate extends Doctrine_Template
      {
          public function setTableDefinition() 
          {
              //... Person fields (e.g. name, address, etc.)
          }
      }
      

      Now I create 2 class that implement PersonTemplate

      class Student extends Doctrine_Record
      {
          public function setUp()
          {
              $this->actAs('PersonTemplate');
          }
      }
      
      class Teacher extends Doctrine_Record
      {
          public function setUp()
          {
              $this->actAs('PersonTemplate');
          }
      }
      

      Then I set implementation on Doctrine_Manager:

      Doctrine_Manager::getInstance()->setImpl('PersonTemplate', 'Student')->setImpl('PersonTemplate', 'Teacher');
      

      Now isn't it only Teacher record recognized as implementation of PersonTemplate ( when we see from this code: $this->_impl[$template] = $class; )

      So how we can implement a template into seperated different doctrine record?

        Activity

        B. Ariston Darmayuda created issue -
        Hide
        Richard C. Hidalgo added a comment - - edited

        As the doc says "Tip The implementations for the templates can be set at manager, connection and even at the table level." it is supposed one can do:

        Doctrine_Manager::getInstance()->getTable('Student')->setImpl('PersonTemplate', 'Student');
        Doctrine_Manager::getInstance()->getTable('Teacher')->setImpl('PersonTemplate', 'Teacher');
        

        but for me it throws an exception:

        "Couldn't find concrete implementation for template PersonTemplate"

        thx

        Show
        Richard C. Hidalgo added a comment - - edited As the doc says "Tip The implementations for the templates can be set at manager, connection and even at the table level." it is supposed one can do: Doctrine_Manager::getInstance()->getTable('Student')->setImpl('PersonTemplate', 'Student'); Doctrine_Manager::getInstance()->getTable('Teacher')->setImpl('PersonTemplate', 'Teacher'); but for me it throws an exception: "Couldn't find concrete implementation for template PersonTemplate" thx

        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=DC-801, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            B. Ariston Darmayuda
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: