Created models for all database objects

This commit is contained in:
2019-05-31 14:18:34 +02:00
parent 4fa01d4cc0
commit 4ce8fd274d
14 changed files with 634 additions and 11 deletions

View File

@@ -81,20 +81,24 @@ abstract class AbstractCommonClubsModelFactory
}
private $joins = null;
/**
* @return AbstractCommonClubsModelJoin[]
*/
public function getJoins($force = False)
{
if($this->joins === null || $force)
$this->joins = $this->fetchJoins();
return $this->joins;
return $this->joins;
}
/**
*
* @param string $condition
* @param string|array $sorting
* @return array
*/
public function loadElements($condition = null)
public function loadElements($condition = null, $sorting = null, $callback = null)
{
$db = Factory::getDbo();
$q = $db->getQuery(true);
@@ -109,11 +113,17 @@ abstract class AbstractCommonClubsModelFactory
$q->select('main.id AS id');//->select($columns);
$q->from($this->getTableName() . ' AS main');
// TODO Joins
if($condition !== null)
$q->where($condition);
if($sorting !== null)
$q->order($sorting);
if($callback !== null)
{
$callback($q);
}
$db->setQuery($q);
$db->execute();