public function deleteTags($tag_names, PDO $con = null) { $tags = TagDb::selectByAppIdForUpdate($this->getId(), $con); $delete_ids = array(); $this->tags = new TagSet(); foreach ($tags as $tag) { if (in_array($tag->getName(), $tag_names)) { $delete_ids[] = $tag->getId(); } else { $this->tags[] = $tag; } } TagDb::deleteByIds($delete_ids, $con); }
public function getTags() { return $this->hasMany(TagDb::className(), ['id' => 'tag']); }
public function delete($con = null) { TagDb::removeFromPackage($this, $con); return parent::delete($con); }