Google Groups Home
Help | Sign in
Taggable Plugin
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all
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
Mushing Fan  
View profile
 More options 30 Apr, 10:44
From: Mushing Fan <jphi...@noatak.com>
Date: Wed, 30 Apr 2008 02:44:39 -0700 (PDT)
Local: Wed 30 Apr 2008 10:44
Subject: Taggable Plugin
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?

    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.
Jonathan Wage  
View profile
 More options 30 Apr, 15:02
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Wed, 30 Apr 2008 09:02:30 -0500
Local: Wed 30 Apr 2008 15:02
Subject: Re: [doctrine-dev] 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

    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.
J. Philip  
View profile
 More options 30 Apr, 23:48
From: "J. Philip" <jphi...@noatak.com>
Date: Wed, 30 Apr 2008 14:48:30 -0800
Local: Wed 30 Apr 2008 23:48
Subject: RE: [doctrine-dev] Re: Taggable Plugin
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


    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.
Jonathan Wage  
View profile
 More options 1 May, 04:16
From: Jonathan Wage <jonw...@gmail.com>
Date: Wed, 30 Apr 2008 22:16:32 -0500
Local: Thurs 1 May 2008 04:16
Subject: Re: [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:


    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.
J. Philip  
View profile
 More options 1 May, 07:16
From: "J. Philip" <jphi...@noatak.com>
Date: Wed, 30 Apr 2008 22:16:22 -0800
Local: Thurs 1 May 2008 07:16
Subject: RE: [doctrine-dev] Re: Taggable Plugin
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 ?


    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.
Jonathan Wage  
View profile
 More options 1 May, 15:02
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Thu, 1 May 2008 09:02:48 -0500
Local: Thurs 1 May 2008 15:02
Subject: Re: [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)

--
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.
J. Philip  
View profile
 More options 1 May, 19:45
From: "J. Philip" <jphi...@noatak.com>
Date: Thu, 1 May 2008 10:45:24 -0800
Local: Thurs 1 May 2008 19:45
Subject: RE: [doctrine-dev] Re: Taggable Plugin
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.


    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.
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

--
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.
isleshocky77  
View profile
 More options 23 May, 20:46
From: isleshocky77 <sost...@sowebdesigns.com>
Date: Fri, 23 May 2008 12:46:17 -0700 (PDT)
Local: Fri 23 May 2008 20:46
Subject: Re: Taggable Plugin
J. Philip,
  Any update on this?  This would be a great plugin functionality to
have.

-- Stephen Ostrow <sost...@sowebdesigns.com>

On May 1, 3:01 pm, "Jonathan Wage" <jonw...@gmail.com> wrote:


    Reply to author