Successfully tested create, update and delete of trivial elements
This commit is contained in:
@@ -6,6 +6,9 @@ use Joomla\CMS\Factory;
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class AssociatedObjectUnsavedException extends Exception
|
||||
{}
|
||||
|
||||
abstract class AbstractCommonClubsModel
|
||||
{
|
||||
// TODO Adddata validator
|
||||
@@ -27,9 +30,9 @@ abstract class AbstractCommonClubsModel
|
||||
|
||||
private $values = null;
|
||||
|
||||
protected function getValues()
|
||||
protected function getValues($force = false)
|
||||
{
|
||||
if(is_null($this->values))
|
||||
if(is_null($this->values) || $force)
|
||||
$this->loadDataFromDatabase();
|
||||
|
||||
return $this->values;
|
||||
@@ -128,7 +131,14 @@ abstract class AbstractCommonClubsModel
|
||||
if(is_null($vals[$k]))
|
||||
continue;
|
||||
|
||||
$vals[$k] = $vals[$k]->getId();
|
||||
$id = $vals[$k]->getId();
|
||||
|
||||
if($id === 'new')
|
||||
{
|
||||
throw new AssociatedObjectUnsavedException();
|
||||
}
|
||||
|
||||
$vals[$k] = $id;
|
||||
}
|
||||
|
||||
return $vals;
|
||||
|
||||
Reference in New Issue
Block a user