Ejemplo n.º 1
0
 public function deleteItemsFromList($list_id, $ebay_ids)
 {
     if (empty($list_id) or empty($ebay_ids)) {
         return false;
     }
     if (!is_array($ebay_ids)) {
         $ebay_ids = (array) $ebay_ids;
     }
     $sql = array();
     $sql[] = 'DELETE t.*';
     $sql[] = 'FROM ' . ListingNamesItems::model()->tableName() . ' t';
     $sql[] = 'JOIN ' . $this->tableName() . ' itm ON itm.id=t.listing_item_id';
     $sql[] = 'WHERE itm.ebay_id IN (' . implode(',', $ebay_ids) . ') AND t.listing_name_id=:list_id';
     $params = array(':list_id' => $list_id);
     $sql = implode(' ', $sql);
     /* @var $command CDbCommand */
     $command = Yii::app()->db->createCommand($sql);
     return $command->execute($params);
 }
Ejemplo n.º 2
0
 public function truncateList($list_id)
 {
     return ListingNamesItems::model()->deleteAll('listing_name_id=:list_id', array(':list_id' => $list_id));
 }