/**
  * Returns a result set from the database.
  *
  * @access  public
  * @return  \mako\database\midgard\ResultSet
  */
 public function all()
 {
     if (!$this->lazy) {
         array_shift($this->wheres);
     }
     return parent::all();
 }
Beispiel #2
0
 /**
  * Deletes a record from the database.
  *
  * @access  protected
  * @param   \mako\database\midgard\Query  $query  Query builder
  * @return  boolean
  */
 protected function deleteRecord($query)
 {
     return (bool) $query->where($this->primaryKey, '=', $this->columns[$this->primaryKey])->delete();
 }
 /**
  * Deletes a record from the database.
  *
  * @access  protected
  * @param   \mako\database\midgard\Query  $query  Query builder
  * @return  boolean
  */
 protected function deleteRecord($query)
 {
     $lockingColumn = $this->getLockingColumn();
     $query->where($lockingColumn, '=', $this->columns[$lockingColumn]);
     $deleted = parent::deleteRecord($query);
     if (!$deleted) {
         throw new StaleRecordException(vsprintf("%s(): Attempted to delete a stale record.", [__METHOD__]));
     }
     return $deleted;
 }
Beispiel #4
0
 /**
  *
  */
 public function testScope()
 {
     $model = new ScopedModel();
     $query = new Query($this->getConnecion(), $model);
     $query->popular();
     $this->assertEquals($query->getTable(), 'barfoo');
 }