Google Groups Home
Help | Sign in
Message from discussion Taggable Plugin
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Jonathan Wage  
View profile
 More options 1 May, 20:01
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Thu, 1 May 2008 14:01:23 -0500
Local: Thurs 1 May 2008 20:01
Subject: Re: [doctrine-dev] Re: Taggable Plugin

I would do as I suggested above. If you did want one table for storing the
relations between Records -> Tags, then I would use column aggregation
inheritance on the RecordTag xref table.

- Jon

On Thu, May 1, 2008 at 1:45 PM, J. Philip <jphi...@noatak.com> wrote:

> The way I wanted it is to have a single Tagging class for all taggable
> models with
> Tag_id
> Taggable_id
> Taggable_model

> It is the principle used by Ror plugin or
> sfPropelActAsTaggableBehaviorPlugin, but it might just be because they
> don't have the power of Doctrine's plugins and templates to generate
> models on the fly.

> The way you suggest, although creating more tables seems more sound as
> it takes advantage of referencial integrity and automatic relation
> management from Doctrine.

> -----Original Message-----
> From: doctrine-dev@googlegroups.com
> [mailto:doctrine-dev@googlegroups.com] On Behalf Of Jonathan Wage
> Sent: Thursday, May 01, 2008 6:03 AM
> To: doctrine-dev@googlegroups.com
> Subject: [doctrine-dev] Re: Taggable Plugin

> Hmm. You should be able to create this model setup with the behavior
> system.

> BlogPost - actAs Taggable - This would create the following:

> BlogPostTag
> - blog_post_id(primary)
> - tag_id(primary)

> Tag(only created if it doesn't already exist, or if it is configured to
> use an existing Tag model)
> - name

> Now you can create the following relationships:

> BlogPost hasMany Tag as Tags(local: blog_post_id, foreign: tag_id,
> refClass: BlogPostTag)
> Tag hasMany BlogPost as BlogPosts(local: tag_id, foreign: blog_post_id,
> refClass: BlogPostTag)

> On Thu, May 1, 2008 at 1:16 AM, J. Philip <jphi...@noatak.com> wrote:

> I created a couple of tickets.

> Another question:

> The relation between the Taggale class and the Tag class is polymorphic,
> so it is not possible to have a regular Doctrine relation between the 2
> because Doctrine want to export a foreign key and it is not possible.
> Turning off constrain export for the table turns off export of the other
> foreign keys. (Not good)
> So the alternative would be to keep track of the tags collection
> manually in the template and save, insert it in a listener.

> Is there a way to take advantage of Doctrine's automatic relation
> management in a case like this ?

> -----Original Message-----
> From: doctrine-dev@googlegroups.com
> [mailto:doctrine-dev@googlegroups.com] On Behalf Of Jonathan Wage

> Sent: Wednesday, April 30, 2008 7:17 PM
> To: doctrine-dev@googlegroups.com
> Subject: [doctrine-dev] Re: Taggable Plugin

> Can you create tickets for the issues you are finding? Their are known
> bugs that have not been worked on yet but now would be a good time to
> get this component stabilized.

> Thanks

> On Apr 30, 2008, at 5:48 PM, "J. Philip" <jphi...@noatak.com> wrote:

> > Thanks Jon,

> > I made a little progress.
> > I got to export the sql without relations yet.
> > I used a child class extending from Doctrine_Record_Generator for the
> > Tagging model. I instanciate the TaggingGenerator class in the
> > Taggable template contructor and add it to the clildren options before

> > instanciating the TagGenerator class.
> > I works but I had to override the buildChildDefinitions method as it
> > seems buggy.
> > Replacing:
> >  $child->setTable($this->_table);
> >  $child->setUp();
> > With
> >  $child->initialize($this->_table);
> > Seems to work. (I don't think there is any setTable method in
> > Doctrine_Record_Generator)
> > I got the sql for both tables exported, but the option 'generateFiles'
> > does not seem to do anything. I tought it would generate model files,
> > but I could not find any call to it anywhere.

> > Now I have work on the relationships.

> > Jacques

> > -----Original Message-----
> > From: doctrine-dev@googlegroups.com
> > [mailto:doctrine-dev@googlegroups.com] On Behalf Of Jonathan Wage
> > Sent: Wednesday, April 30, 2008 6:03 AM
> > To: doctrine-dev@googlegroups.com
> > Subject: [doctrine-dev] Re: Taggable Plugin

> > I think the best way to do this right now would be you just have a
> > standalone child class extending from Doctrine_Record and have the
> > behavior configurable for the Tag model to use. It will default to the

> > one bundled with the behavior, but the plugin could be configured to
> > use
> > something else if required.

> > - Jon

> > On Wed, Apr 30, 2008 at 4:44 AM, Mushing Fan <jphi...@noatak.com>
> > wrote:

> > I was trying to create a Taggable plugin, I followed the documentation
> > and example of the Versionable plugin, but I am not sure how to
> > implement a plugin that needs 2 tables. (A Tag and Taggable class)
> > I understood I have to create a Template to extend the classes that
> > will be taggable.
> > The template instantiates a generator that is placed in its_plugin
> > property and eventually adds a listener to act upon changes in the
> > records.
> > But is it possible to add 2 generators to a template?

> > --
> > Jonathan Wage
> > http://www.jwage.com
> > http://www.centresource.com

> --
> Jonathan Wage
> http://www.jwage.com
> http://www.centresource.com

--
Jonathan Wage
http://www.jwage.com
http://www.centresource.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google