Q:

Remove tag association when deleting an item in own component

I followed the MVC Tutorial from Joomla as close as possible to create my own component. I included Joomlas Tags system within my component using the Observer technique in the JTable class
class ComponentTableItem extends JTable
{
  function __construct(&$db)
  {
    parent::__construct('#__cmp_item', 'id', $db);
    JTableObserverTags::createObserver($this, array('typeAlias' => 'com_component.item'));
 }
}

Inserting new items and adding Tags works fine. But when I delete the item, the tags associations are not deleted. I use the following code to delete multiple entries in Model/Items.php:
public function delete(&$pks)
{
    $db = JFactory::getDbo();

    $pks = (array)$pks;

    // Iterate the items to delete each one.
    foreach ($pks as $i => $pk) {
        $item = JTable::getInstance('item', 'ComponentTable');
        $item->load($pk);
        //...do some stuff
        //and finally delete the item
        $item->delete($pk);
     }
 }

I was under the impression that the ObserverClass in the JTable class would take care of it, but that doesn't seem to be the case.
Any pointers?

A:

I figured it out.
Instead of using the JTable class, I import the model gameModel as described here.
The by deleting the item via the model, the tag-associations are removed as well.
This is the code change:
    public function delete(&$pks)
    {
    jimport('joomla.application.component.model');
    JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_mycomponent/models');
    $db = JFactory::getDbo();

    $pks = (array)$pks;

    // Iterate the items to delete each one.
    foreach ($pks as $i => $pk) {
        $item = JModelLegacy::getInstance( 'Item', 'ComponentModel' );
        $item->getItem($pk);
        //...do some stuff
        //and finally delete the item
        $item->delete($pk);
     }
 }

