/** * @param \Thru\ActiveRecord\DatabaseLayer\Passthru $thing * @return array * @throws \Thru\ActiveRecord\DatabaseLayer\Exception */ public function processPassthru(DatabaseLayer\Passthru $thing) { $sql = $thing->getSqlToPassthru(); $result = $this->query($sql, $thing->getModel()); // TODO: Make this a Collection. $results = array(); if ($result !== false && $result !== null) { foreach ($result as $result_item) { $results[] = $result_item; } } return $results; }
/** * @expectedException \Thru\ActiveRecord\DatabaseLayer\Exception */ public function testPassthruInvalidSQL() { $query = "this isn't the sql you're looking for."; $passthru = new \Thru\ActiveRecord\DatabaseLayer\Passthru(); $passthru->query($query); $this->assertEquals($query, $passthru->getSqlToPassthru()); $passthru->execute(); }