Added first association of clubs. Current structure does not allow for joins.

This commit is contained in:
2019-05-17 15:27:03 +02:00
parent c459e1d332
commit f8df0c3fc4
5 changed files with 120 additions and 3 deletions

View File

@@ -29,12 +29,18 @@ abstract class AbstractClubsModel
$this->$m = $data[$m];
}
protected static function loadElements(string $tableName, string $className)
protected static function loadElements(string $tableName, string $className, $where = null)
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$q->select('*')
->from($tableName);
if(isset($where))
{
$q->where($where);
}
$dbo->setQuery($q);
$dbo->execute();
$list = $dbo->loadAssocList();
@@ -60,7 +66,10 @@ abstract class AbstractClubsModel
{
$dbo = Factory::getDbo();
$q = $dbo->getQuery(true);
$q->select('*')->from($tableName)->where('id=' . (int) $id);
$q->select('*')->from($tableName);
$q->where('id=' . (int) $id);
$dbo->setQuery($q);
$dbo->execute();