/**
  * Which Carts need to be deleted
  *
  * @return Market_OrderModel[]
  */
 public function getCartsToPurge()
 {
     $configInterval = craft()->market_settings->getSettings()->purgeIncompleteCartDuration;
     $edge = new DateTime();
     $interval = new DateInterval($configInterval);
     $interval->invert = 1;
     $edge->add($interval);
     $records = Market_OrderRecord::model()->findAllByAttributes(['dateOrdered' => null], 'dateUpdated <= :edge', ['edge' => $edge->format('Y-m-d H:i:s')]);
     return Market_OrderModel::populateModels($records);
 }
 /**
  * @param string $email
  *
  * @return Market_OrderModel[]
  */
 public function getByEmail($email)
 {
     $orders = Market_OrderRecord::model()->findAllByAttributes(['email' => $email]);
     return Market_OrderModel::populateModels($orders);
 }