Example #1
0
 public function deleteByField($field, $value = null)
 {
     if (is_array($field)) {
         $items = $this->getByField($field, $this->id);
         $ids = array_keys($items);
     } else {
         if ($field == $this->id) {
             $ids = $value;
         } else {
             $items = $this->getByField($field, $value, $this->id);
             $ids = array_keys($items);
         }
     }
     $res = false;
     if ($ids) {
         if ($res = parent::deleteByField($this->id, $ids)) {
             $product_model = new shopProductModel();
             $data = array('type_id' => null);
             $product_model->updateByField('type_id', $ids, $data);
             $type_features_model = new shopTypeFeaturesModel();
             $type_features_model->deleteByField('type_id', $ids);
         }
     }
     return $res;
 }