private function load() { if (!$this->loaded) { $this->exchangeArray($this->q->find()); $this->loaded = true; } }
public function get($class, $pk) { $pkProps = array_keys($this->config->getEntity($class)->getPkProperties()); $query = new OutletQuery($class, $this->session); return $query->where("{{$class}." . join("} = ? AND {{$class}.", $pkProps) . '} = ?', $pk)->findOne(); }
/** * Create an OutletQuery selecting from an entity table * @param string $from entity table to select from * @return OutletQuery unexecuted */ public function from($from) { require_once 'OutletQuery.php'; $q = new OutletQuery($this); $q->from($from); return $q; }
public function testFluentInterface() { $query = new OutletQuery(); $result = $query->from('Entity')->where('where')->orderBy('order')->offset(3)->limit(1)->leftJoin('left')->innerJoin('join')->with('OtherEntity')->groupBy('group')->having('having')->select('select'); $this->assertThat($result, $this->isInstanceOf('OutletQuery')); }