/** * * @param Incoming $incoming_ * @param array $arrayFilter * @throws InvalidArgumentException */ public function insertIncoming(Incoming $incoming_, array $arrayFilter = array()) { try { if (is_null($this->table)) { throw new InvalidArgumentException('Attribute "table" can\'t be NULL !'); } $userMapper = new UserMapper(); $userMapper->setId($incoming_->getIdUser()); $user = $userMapper->selectUser(); if (!is_null($user->getId())) { return parent::insert($this->table, $incoming_, $arrayFilter); } elseif (isset($user) && is_null($user->getId())) { throw new Exception('User does not exist !'); } } catch (Exception $e) { print $e->getMessage(); exit; } }
public function testPut() { $incoming = new Incoming(); $incoming->setId('1'); $incoming->setTitle('News test'); $incoming->setSubtitle('subtitle'); $incoming->setContent('une news'); $incoming->setPostDate('2012-12-14 18:07:27'); $incoming->setIdUser(1); $incomingMapper = new IncomingMapper(); $incomingMapper->setId(1); $incomingMapper->updateIncoming($incoming); $this->assertEquals($incoming, $incomingMapper->selectIncoming()); }
public function testGetSetPostDate() { $incoming = new Incoming(); $incoming->setPostDate('2012-12-01 12:00:00'); $this->assertEquals('2012-12-01 12:00:00', $incoming->getPostDate()); }
</div> </div> </div> <?php $this->endWidget(); ?> <div class="col-md-12"> <?php if (Yii::app()->request->isPostRequest) { $searchModel = new Subs(); $subs_model_class_name = $searchModel->getClassName(); $client = $_POST[$subs_model_class_name]['msisdn']; $cond = "msisdn = '{$client}'"; $searchModel = Subs::model()->searchModel(array(), 100, 'sync_date', $cond); if (!empty($searchModel)) { $service_id = $searchModel->serviceid; $search = " dest_msisdn = '{$client}' "; $textSmses = Incoming::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'timestamp', $search); $terminations = Terminations::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'timestamp', $search); $this->renderPartial('repos', array('searchModel' => $searchModel, 'textSmses' => $textSmses, 'terminations' => $terminations)); } } ?> </div>