Example #1
0
 public function executeDiscardDraft()
 {
     $param = $this->getAllRequestParameter();
     $this->userInit();
     $user_id = $this->user->getAttribute('user_id', null, 'bo');
     if (!empty($param['id'])) {
         $draftCriteria = new Criteria();
         $draftCriteria->add(SmsDraftPeer::ID, $param['id'], Criteria::EQUAL);
         $draftCriteria->add(SmsDraftPeer::CREATOR_USER_ID, $user_id, Criteria::EQUAL);
         $draftCriteria->add(SmsDraftPeer::CREATOR_TYPE, $this->userType, Criteria::EQUAL);
         $draft = SmsDraftPeer::doSelectOne($draftCriteria);
         $draft->delete();
     }
     $this->jsonwrapper->print_json(array('success' => 1, 'data' => $draft->toArray()));
 }
Example #2
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(SmsDraftPeer::ID, $pks, Criteria::IN);
         $objs = SmsDraftPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = SmsDraftPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCreatorUserId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCreatorType($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCreated($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setRecipient($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setSubject($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setMessage($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setScheduled($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setScheduleTime($arr[$keys[8]]);
     }
 }