Esempio n. 1
0
 /**
  * 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();
 }
Esempio n. 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;
 }
Esempio n. 4
0
 /**
  *
  */
 public function testScope()
 {
     $model = new ScopedModel();
     $query = new Query($this->getConnecion(), $model);
     $query->popular();
     $this->assertEquals($query->getTable(), 'barfoo');
 }