Пример #1
0
 public function testAddNewIdWithObjects()
 {
     $obj = new \Application\Model\SimModel();
     $data = array('t1', $obj, 't4');
     $this->assertTrue($this->_memoryCache->save($data, 'test2'));
     $loaded = $this->_memoryCache->load('test2');
     $obj->setMsisdn('600600600');
     $this->assertNotEquals($data[1], $loaded[1]);
 }
Пример #2
0
 /**
  * Validate element value
  *
  * @param  array   $data
  * @param  mixed   $context
  * @return boolean
  */
 public function isValid($value, $context = array())
 {
     $arrayValidator = new App_Validate_Array(array('validators' => array('SimApn' => array('breakChainOnFailure' => true))));
     if (!$arrayValidator->isValid($value, $context)) {
         $this->_messages = $arrayValidator->getMessages();
         return false;
     }
     $sim = new Application\Model\SimModel($context);
     $apns = $sim->getCustomer()->getApnList();
     $staticApns = array_keys($apns, true);
     $commonApns = array_intersect($value, $staticApns);
     if (count($commonApns) > 1) {
         $this->_error(self::TOO_MANY_STATIC_ADDRESSIN_APNS);
         return false;
     }
     return true;
 }
Пример #3
0
 /**
  * Validate element value
  *
  * @param  array   $data
  * @param  mixed   $context
  * @return boolean
  */
 public function isValid($value, $context = array())
 {
     if (empty($value)) {
         return true;
     }
     if (!isset($context)) {
         $this->_error(self::INVALID_SIM);
         return false;
     }
     $sim = new Application\Model\SimModel($context);
     if (!$sim->getCustomer()) {
         $this->_error(self::INVALID_CUSTOMER);
         return false;
     }
     $apns = $sim->getCustomer()->getApnList();
     if (!in_array($value, array_keys($apns))) {
         $this->_error(self::APN_NOT_IN_CUSTOMER, $value);
         return false;
     }
     return true;
 }
 private function checkPermissions($data)
 {
     // Check permissions
     $sim = Application\Model\SimModel::find($data['subscription_id']['id']);
     if (empty($sim)) {
         throw new AppEx\NotFoundException('SIM not found');
     }
     $this->_helper->allowed('update', $sim);
 }