Ticket #936 (closed defect: fixed)

Opened 15 months ago

Last modified 14 months ago

Adding Child Template to Template doesn't work since 0.10.1

Reported by: micatom Owned by: romanb
Priority: critical Milestone: 0.11.0
Component: Record Version: 0.11.0
Severity: Keywords: addChild Record Generator Template
Cc: Has Test:
Status: Has Patch:

Description

Taking Wiki Class example :

i18n->addChild() doesn't work anymore since 0.10.1 release.

addChild(Doctrine_Template) is delegated to the Doctrine_Record_Generator::addChild(Doctrine_Record_Generator)

it breaks causing a cast error.

<?php
class Wiki extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->hasColumn('title', 'string', 255);
        $this->hasColumn('content', 'string');
    }

    public function setUp()
    {
        $options = array('fields' => array('title', 'content'));
        $auditLog = new Doctrine_Template_Versionable($options);
        $search = new Doctrine_Template_Searchable($options);
        $slug = new Doctrine_Template_Sluggable($options);
        $i18n = new Doctrine_Template_I18n($options);

        $i18n->addChild($auditLog)
             ->addChild($search)
             ->addChild($slug);

        $this->actAs($i18n);

        $this->actAs('Timestampable');
    }
}

Result :

Catchable fatal error: Argument 1 passed to Doctrine_Record_Generator::addChild() must be an instance of Doctrine_Record_Generator, instance of Doctrine_Template_Searchable given, called in C:serverApache2htdocssharedDoctrineDoctrineTemplate.php on line 98 and defined in C:serverApache2htdocssharedDoctrineDoctrineRecordGenerator.php on line 115

Attachments

fix_936.patch (5.6 KB) - added by masterzen 14 months ago.
Patch against 0.11RC2 - includes fix and test case

Change History

Changed 15 months ago by micatom

  • owner changed from jwage to romanb
  • component changed from Attributes to Record

Changed 15 months ago by jwage

  • milestone set to 0.10.6

Changed 14 months ago by masterzen

I think the patch I just uploaded fixes the issue. The patch is against 0.11RC2.

Changed 14 months ago by micatom

Thanks, i'll try it soon.

Changed 14 months ago by masterzen

Uploaded a new version of the patch (still against 0.11RC2) that fixes the Sluggable template when used as a child plugin/template. The patch also now contains a working Doctrine_Plugin_TestCase.

Changed 14 months ago by masterzen

Patch against 0.11RC2 - includes fix and test case

Changed 14 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

(In [4347]) fixes #936 - Fixes issue with nested behaviors

Changed 14 months ago by jwage

  • version changed from 0.10 to 0.11

Changed 14 months ago by jwage

  • milestone changed from 0.11.1 to 0.11.0
Note: See TracTickets for help on using tickets.