private function getQueryResult($filter = '') { try { $result = $this->tableRestProxy->queryEntities($this->tableName, $filter); return $result; } catch (ServiceException $e) { $this->output->writeln('<error>[!]</error> Exception Code: <comment>' . $e->getCode() . '</comment>'); $this->output->writeln($e->getMessage()); return $e->getCode(); } }
/** * {@inheritDoc} */ public function executeRangeQuery(RangeQuery $query, $storageName, $key, \Closure $hydrateRow = null) { $filters = array("PartitionKey eq " . $this->quoteFilterValue($query->getPartitionKey())); foreach ($query->getConditions() as $condition) { if (!in_array($condition[0], array('eq', 'neq', 'le', 'lt', 'ge', 'gt'))) { throw new \InvalidArgumentException("Windows Azure Table only supports eq, neq, le, lt, ge, gt as conditions."); } $filters[] = "RowKey " . $condition[0] . " " . $this->quoteFilterValue($condition[1]); } $filter = '(' . implode(" and ", $filters) . ')'; $result = $this->client->queryEntities($storageName, $filter); $rows = array(); foreach ($result->getEntities() as $entity) { $row = $this->getProperties($entity); $rows[] = $hydrateRow ? $hydrateRow($row) : $row; } return $rows; }
/** * Gets a unique slug by chacking storage * * @param $slug * @return bool|string */ public function getUniqueSlug($slug) { $filter = "slug eq '{$slug}'"; try { $result = $this->tableProxy->queryEntities(self::TABLE_AGGREGATION, $filter); $entities = $result->getEntities(); var_dump($entities, count($entities)); if (count($entities) > 0) { $slug = $slug . rand(0, 9); var_dump($slug); return $this->getUniqueSlug($slug); } return $slug; } catch (ServiceException $e) { $code = $e->getCode(); $error_message = $e->getMessage(); echo $code . ": " . $error_message . "<br />"; return false; } }