20 abstract protected function getModel(): string;
31 public function all(
string $condition =
'', $included =
false, array $parameters = [ ],
bool $useCache =
false): array {
32 return
DAO::getAll ( $this->
getModel (), $condition, $included, $parameters, $useCache );
46 public function orderBy(
string $field,
string $order=
'ASC',
string $condition =
'', $included =
false, array $parameters = [ ],
bool $useCache =
false): array {
47 return
DAO::orderBy($this->getModel(), $field, $order, $condition, $included, $parameters, $useCache);
58 public function byId($keyValues, $included =
true,
bool $useCache =
false): ?object {
59 return
DAO::getById ( $this->getModel (), $keyValues, $included, $useCache );
72 public function one(
string $condition =
'', $included =
true, array $parameters = [ ],
bool $useCache =
false): ?object {
73 return
DAO::getOne ( $this->getModel (), $condition, $included, $parameters, $useCache );
84 public function insert(
object $instance,
bool $insertMany =
false): bool {
85 return
DAO::insert ( $instance, $insertMany );
95 public function update(
object $instance,
bool $insertMany =
false): bool {
96 return
DAO::update ( $instance, $insertMany );
106 public function save(
object $instance,
bool $insertMany =
false) {
107 return DAO::save ( $instance, $insertMany );
116 public function remove(
object $instance): ?int {
117 return
DAO::remove ( $instance );
127 public function count(
string $condition=
'',?array $parameters=
null):int {
128 return
DAO::count($this->getModel(),$condition,$parameters);
Base class for controllers.
Gateway class between database and object model.
A repository for managing CRUD operations on a model.
byId($keyValues, $included=true, bool $useCache=false)
Load one instance by id.
update(object $instance, bool $insertMany=false)
Update an instance $instance in the database.
all(string $condition='', $included=false, array $parameters=[], bool $useCache=false)
Load all instances.
orderBy(string $field, string $order='ASC', string $condition='', $included=false, array $parameters=[], bool $useCache=false)
Load all instances with order.
save(object $instance, bool $insertMany=false)
Save (insert or update) an instance $instance in the database.
one(string $condition='', $included=true, array $parameters=[], bool $useCache=false)
Load one instance.
insert(object $instance, bool $insertMany=false)
Insert a new instance $instance into the database.
count(string $condition='',?array $parameters=null)
Returns the number of instances.