コード例 #1
0
 /**
  * testMultipleBelongsToWithSameClass method
  *
  * @return void
  */
 public function testMultipleBelongsToWithSameClass()
 {
     $this->loadFixtures('DeviceType', 'DeviceTypeCategory', 'FeatureSet', 'ExteriorTypeCategory', 'Document', 'Device', 'DocumentDirectory');
     $DeviceType = new DeviceType();
     $DeviceType->recursive = 2;
     $result = $DeviceType->read(null, 1);
     $expected = array('DeviceType' => array('id' => 1, 'device_type_category_id' => 1, 'feature_set_id' => 1, 'exterior_type_category_id' => 1, 'image_id' => 1, 'extra1_id' => 1, 'extra2_id' => 1, 'name' => 'DeviceType 1', 'order' => 0), 'Image' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'Extra1' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'Extra2' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'DeviceTypeCategory' => array('id' => 1, 'name' => 'DeviceTypeCategory 1'), 'FeatureSet' => array('id' => 1, 'name' => 'FeatureSet 1'), 'ExteriorTypeCategory' => array('id' => 1, 'image_id' => 1, 'name' => 'ExteriorTypeCategory 1', 'Image' => array('id' => 1, 'device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1)), 'Device' => array(array('id' => 1, 'device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1), array('id' => 2, 'device_type_id' => 1, 'name' => 'Device 2', 'typ' => 1), array('id' => 3, 'device_type_id' => 1, 'name' => 'Device 3', 'typ' => 2)));
     $this->assertEquals($expected, $result);
 }
コード例 #2
0
 function registerAndSubscribe($userName, $channelName, $deviceToken, $deviceType)
 {
     Util::throwExceptionIfNullOrBlank($userName, "User Name");
     Util::throwExceptionIfNullOrBlank($channelName, "Channel Name");
     Util::throwExceptionIfNullOrBlank($deviceToken, "Device Token");
     Util::throwExceptionIfNullOrBlank($deviceType, "Device Type");
     $objUtil = new Util($this->apiKey, $this->secretKey);
     try {
         $params = null;
         $deviceTypeObj = new DeviceType();
         if ($deviceTypeObj->isAvailable($deviceType) == "null") {
             throw new App42Exception("The device with  type '{$deviceType}' does not Exist ");
         }
         $headerParams = array();
         $queryParams = array();
         $signParams = $this->populateSignParams();
         $metaHeaders = $this->populateMetaHeaderParams();
         $headerParams = array_merge($signParams, $metaHeaders);
         $body = null;
         $body = '{"app42":{"push":{"userName":"******","channelName":"' . $channelName . '","deviceToken":"' . $deviceToken . '","type":"' . $deviceType . '"}}}';
         $signParams['body'] = $body;
         $signature = urlencode($objUtil->sign($signParams));
         //die();
         $headerParams['signature'] = $signature;
         $contentType = $this->content_type;
         $accept = $this->accept;
         $baseURL = $this->url;
         $baseURL = $baseURL . "/subscribeDeviceToChannel";
         $response = RestClient::post($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);
         $pushResponseObj = new PushNotificationResponseBuilder();
         $pushObj = $pushResponseObj->buildResponse($response->getResponse());
     } catch (App42Exception $e) {
         throw $e;
     } catch (Exception $e) {
         throw new App42Exception($e);
     }
     return $pushObj;
 }
コード例 #3
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      DeviceType $value A DeviceType object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(DeviceType $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #4
0
ファイル: BaseDevice.php プロジェクト: navid045/maxlaptop
 /**
  * Declares an association between this object and a DeviceType object.
  *
  * @param      DeviceType $v
  * @return     Device The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setDeviceType(DeviceType $v = null)
 {
     if ($v === null) {
         $this->setTypeId(NULL);
     } else {
         $this->setTypeId($v->getId());
     }
     $this->aDeviceType = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the DeviceType object, it will not be re-added.
     if ($v !== null) {
         $v->addDevice($this);
     }
     return $this;
 }