public static function deleteTagsForObject($tagTable, DatabaseObject &$object, $tagArrayValue, $databaseColumn) { if (!$object->isSaved()) { return; } if (!is_array($tagArrayValue)) { $tagArrayValue = array($tagArrayValue); } $_tags = array(); foreach ($tagArrayValue as $tag) { $tag = trim($tag); if (strlen($tag) > 0) { $_tags[] = $tag; } if (count($_tags) == 0) { continue; } } $where = array($databaseColumn . '=' . $object->getId(), $object->_db->quoteInto('lower(tag) in (?)', $tagArrayValue)); $object->_db->delete($tagTable, $where); }
public static function markAsNew(DatabaseObject $product, $status, $seller_type) { $id = $product->getId(); $data = array('new' => $status); $product->_db->update($product->_table, $data, "{$product->_idField} = {$id}"); }