public function onAfterInsert($object, array $new, array $metadata) { if ($object instanceof Workflow) { $workflow = $object; // If we're creating a discussion, the discussion initially has 0 // topics, so create empty TopKIndex's. (This way, after we add the // initial topics, we don't have to do a cache fill from the DB, // until the cache expires.). if ($workflow->getType() === 'discussion') { $indexed = array('topic_list_id' => $workflow->getId()); $this->cache->set($this->cacheKey($indexed), array()); } // Do nothing when topic workflows are inserted return; } parent::onAfterInsert($object, $new, $metadata); }
/** * @param Header|PostRevision $object * @param string[] $new * @param array $metadata */ public function onAfterInsert($object, array $new, array $metadata) { $new['topic_list_id'] = $this->findTopicListId($object, $new, $metadata); parent::onAfterInsert($object, $new, $metadata); }