Exemplo n.º 1
0
<?php

class myExampleSet extends weeDbSet
{
    public function fetch($iId)
    {
        return $this->getDb()->query('
			SELECT * FROM table WHERE the_id=?
		', $iId)->rowClass('myExampleModel')->fetch();
    }
    public static function instance()
    {
        return new self();
    }
}
// Example use:
$oModel = myExampleSet::instance()->fetch(42);
Exemplo n.º 2
0
<?php

class myExampleSet extends weeDbSet
{
    protected $sModel = 'myExampleModel';
    public function fetch($iId)
    {
        return $this->queryRow('
			SELECT * FROM table WHERE the_id=?
		', $iId);
    }
    public function fetchAll()
    {
        return $this->query('
			SELECT * FROM table
		');
    }
    public static function instance()
    {
        return new self();
    }
}
// Example use:
$oModel = myExampleSet::instance()->fetch(42);
$oResults = myExampleSet::instance()->fetchAll();
Exemplo n.º 3
0
<?php

$iCount = count(myExampleSet::instance());
Exemplo n.º 4
0
class myExampleSet extends weeDbSet
{
    protected $sModel = 'myExampleModel';
    public function count()
    {
        return $this->queryValue('
			SELECT COUNT(*) FROM table
		');
    }
    public function fetch($iId)
    {
        return $this->queryRow('
			SELECT * FROM table WHERE the_id=?
		', $iId);
    }
    public function fetchAll()
    {
        return $this->query('
			SELECT * FROM table
		');
    }
    public static function instance()
    {
        return new self();
    }
}
// Example use:
$oModel = myExampleSet::instance()->fetch(42);
$oResults = myExampleSet::instance()->fetchAll();
$iCount = myExampleSet::instance()->count();