diff --git a/lib/Models/Model.php b/lib/Models/Model.php index 6865499433..7a15c1b975 100644 --- a/lib/Models/Model.php +++ b/lib/Models/Model.php @@ -138,10 +138,14 @@ class Model extends \Sudzy\ValidModel { } /** - * @return bool|static + * @return static */ static function create() { - return parent::create(); + $created = parent::create(); + if (is_bool($created)) { + throw new \Exception('ORM is not initialised'); + } + return $created; } /** diff --git a/lib/Util/Sudzy/ValidModel.php b/lib/Util/Sudzy/ValidModel.php index adee053d29..7af4f64fe8 100644 --- a/lib/Util/Sudzy/ValidModel.php +++ b/lib/Util/Sudzy/ValidModel.php @@ -2,7 +2,7 @@ namespace Sudzy; /** - * @method static ORMWrapper|bool create($data=null) + * @method static static|bool create($data=null) */ abstract class ValidModel extends \Model { protected $_validator = null; // Reference to Sudzy validator object