public function setUp() { //setup test data to query $AVObject = new AVObject('test'); $AVObject->score = 1111; $AVObject->name = 'Foo'; $AVObject->mode = 'cheat'; $this->AVObject = $AVObject->save(); $AVObject2 = new AVObject('test'); $AVObject2->score = 2222; $AVObject2->name = 'Bar'; $AVObject2->mode = 'nocheat'; $AVObject2->phone = '555-555-1234'; $AVObject2->object1 = $AVObject2->dataType('pointer', array('test', $this->AVObject->objectId)); $this->AVObject2 = $AVObject2->save(); $this->AVQuery = \Enhance\Core::getCodeCoverageWrapper('AVQuery', array('test')); $this->AVQueryUser = \Enhance\Core::getCodeCoverageWrapper('AVQuery', array('users')); }
/** * Execute a find query and return the results. * * @param boolean $useMasterKey * * @return array */ public function find($useMasterKey = false) { $sessionToken = null; if (AVUser::getCurrentUser()) { $sessionToken = AVUser::getCurrentUser()->getSessionToken(); } $queryString = $this->buildQueryString($this->_getOptions()); $result = AVClient::_request('GET', '/classes/' . $this->className . '?' . $queryString, $sessionToken, null, $useMasterKey); $output = array(); foreach ($result['results'] as $row) { $obj = AVObject::create($this->className, $row['objectId']); $obj->_mergeAfterFetchWithSelectedKeys($row, $this->selectedKeys); $output[] = $obj; } return $output; }
public function __construct() { parent::__construct(); $this->order = new AVObject('order'); }
/** * Save the current user object, unless it is not signed up. * * @param bool $useMasterKey * @throws AVException * @return null * */ public function save($useMasterKey = false) { if ($this->getObjectId()) { parent::save($useMasterKey); } else { throw new AVException("You must call signUp to create a new User."); } }