model() public static method

Returns the static model of the specified AR class.
public static model ( string $className = __CLASS__ ) : OrderHistory
$className string active record class name.
return OrderHistory the static model class
Ejemplo n.º 1
0
 public function afterUninstall()
 {
     Yii::app()->settings->clear($this->id);
     //Yii::app()->unintallComponent('cart');
     $db = Yii::app()->db;
     $tablesArray = array(Order::model()->tableName(), OrderHistory::model()->tableName(), OrderProduct::model()->tableName(), OrderStatus::model()->tableName(), OrderProductHistroy::model()->tableName(), ShopPaymentMethod::model()->tableName(), ShopPaymentMethodTranslate::model()->tableName(), ShopDeliveryMethod::model()->tableName(), ShopDeliveryMethodTranslate::model()->tableName(), ShopDeliveryPayment::model()->tableName(), ProductNotifications::model()->tableName());
     foreach ($tablesArray as $table) {
         $db->createCommand()->dropTable($table);
     }
     return parent::afterInstall();
 }
Ejemplo n.º 2
0
 /**
  * @param CModelEvent $event
  */
 public function afterDelete($event)
 {
     OrderHistory::model()->deleteAllByAttributes(array('order_id' => $event->sender->id));
 }
Ejemplo n.º 3
0
 /**
  * Load history
  *
  * @return array
  */
 public function getHistory()
 {
     $cr = new CDbCriteria();
     $cr->order = 'created ASC';
     return OrderHistory::model()->findAllByAttributes(array('order_id' => $this->id), $cr);
 }