FabienPennequin/DoctrineExtensions-Taggable — pull request #9 by Nemesisprime (2012-07-12 13:54:11+00:00)
Title: Storing metadata with the tagging object

What's up Fabien?

To extend the usability of tags, I needed to store tag-resource specific information and to go about doing that, I added a couple changes to allow for the easy addition of metadata to the Tagging object.

It's completely backwards compatible and requires very little to add metadata to tag objects:

$tag = $tag_manager->loadOrCreateTag('Blue');

$tag_metadata = new TagMetadata();
$tag_metadata->add("TagUser", $user);
$tag_metadata->add("IsMachine", false);

$tag_manager->addTagWithMetadata($tag, $tag_metadata, $resource);
$tag_manager->saveTagging($resource);

Because the metadata is stored in the Tagging table, the database schema will need to be updated accordingly with the metadata-enabled fields, prefixed with "metadata_" (e.g., 'metadata_tag_user', 'metadata_is_machine').

This is definitely something up for discussion as it is a first run and quick bit addition, and probably could be improved.