Great start! We've talked about this on IRC already, but I'm replying here for
official record. Sorry it's a bit late.
> At the moment tags functionality appears to be working. The interface
> is basically the same as what we are used to with the current tag/tags
> interface, with one exception. Since the Term class implements a get()
> method, Tag::get() has to have the same interface, so it is now
> Tag::get($vocab_id, $term_id) rather than Tag::get($tag). $vocab_id is
> the id of the Vocabulary from which you are getting the tag. 'tags' is
> the name of the vocabulary in the current code. $term_id is the id of
> the tag you are trying to get.
>
> The Tag class is implemented by extending the Term class. Term::objects
> () and Term::associate() were fleshed out to be able to add tags to
> the object_terms table.
If Tag doesn't extend Term, but uses it internally, then there is no need to
change the current API. Of course, if the Tag API needs improving, we should
change it, but I think this would be a case of leaking abstraction
> A Term::remove_association() method was created to facilitate remove
> associations from the object_terms table, and Utils::object_type_id() was
> added to the Utils class to facilitate getting the id of an object type.
Minor, but I'd prefer that a method to remove an association was symmetrical
with the method to add an association, so either associate() and dessociate()
or add_association() and remove_association().
> Current issues include:
> 1. Tags::get() will be very slow when the site has hundreds of tags.
> Is there a better way to cast the member of an array from one class to
> another than one-by-one in a loop?
Not off the top of my head. Hopefully someone else can chip in.
> 2. The string literal 'post' (the object type with which tags are
> associated) is scattered through the code.
Is that a problem? Do we want this to enable generic tagging of objects?
--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog
IRC: michaeltwofish #habari