public function testHydrationOfALongProperty() { $manager = $this->createManager(); $query = new Query(); $query->update('Profile')->set(array('hash' => 2937480))->where('@rid = ?', '#' . $this->getClassId('Profile') . ':0'); $manager->execute($query); $neoProfile = $manager->find("#" . $this->getClassId('Profile') . ":0"); $this->assertInternalType('integer', $neoProfile->hash); }
/** * @group integration */ public function testExecutionWithNoOutput() { $manager = $this->createManager(); $query = new Query(); $query->update('Address')->set(array('type' => 'Residence')); $results = $manager->execute($query); $this->assertInternalType('bool', $results); $this->assertTrue($results); }
/** * Finds objects by a set of criteria. * * Optionally sorting and limiting details can be passed. An implementation may throw * an UnexpectedValueException if certain values of the sorting or limiting details are * not supported. * * @param array $criteria * @param array|null $orderBy * @param int|null $limit * @param int|null $offset * @return mixed The objects. */ public function findBy(array $criteria, array $orderBy = array(), $limit = null, $offset = null, $fetchPlan = '*:0') { $results = array(); foreach ($this->getOrientClasses() as $mappedClass) { $query = new Query(array($mappedClass)); foreach ($criteria as $key => $value) { $query->andWhere("{$key} = ?", $value); } foreach ($orderBy as $key => $order) { $query->orderBy("{$key} {$order}"); } if ($limit) { $query->limit($limit); } $collection = $this->getManager()->execute($query, $fetchPlan); if (!$collection instanceof ArrayCollection) { throw new Exception("Problems executing the query \"{$query->getRaw()}\". " . "The server returned {$collection} instead of ArrayCollection."); } $results = array_merge($results, $collection->toArray()); } return new ArrayCollection($results); }
/** * {@inheritdoc} */ public function execute(Query $query, $fetchPlan = null) { if ($query->getCommand() instanceof Select) { return $this->query($query->getRaw(), -1, $fetchPlan); } return $this->command($query->getRaw()); }
public function from(array $target = array(), $append = TRUE) { return parent::from($target, $append); }
public function testTruncateNonExistingCluster() { $query = new Query(); $query->truncate('NON_EXISTING_CLUSTER', true); $this->assertHttpStatus(500, $this->doQuery($query)); }