示例#1
0
 /**
  * @param IQuarkRESTServiceDescriptor $descriptor
  * @param string $endpoint
  * @param string $source
  */
 public function __construct(IQuarkRESTServiceDescriptor $descriptor = null, $endpoint = '', $source = '')
 {
     if (func_num_args() == 1) {
         $endpoint = Quark::WebHost();
     }
     if (strlen(trim($source)) == 0) {
         $source = QuarkObject::ClassOf($descriptor);
     }
     $this->_descriptor = $descriptor;
     $this->_endpoint = $endpoint;
     $this->_source = $source;
 }
示例#2
0
 /**
  * @param IQuarkModel $model
  *
  * @return string
  */
 private static function _class(IQuarkModel $model)
 {
     return strtolower(QuarkObject::ClassOf($model));
 }
示例#3
0
 /**
  * @param IQuarkModel $model
  * @param $options
  *
  * @return mixed
  * @throws QuarkArchException
  */
 private function _collection($model, $options)
 {
     $collection = isset($options[QuarkModel::OPTION_COLLECTION]) ? $options[QuarkModel::OPTION_COLLECTION] : QuarkObject::ClassOf($model);
     if ($this->_connection == null) {
         throw new QuarkArchException('MongoDB connection not pooled');
     }
     return $this->_connection->{$collection};
 }