Ubiquity 2.5.2
php rapid development framework
|
A repository for managing CRUD operations on a model, displayed in a view. More...
Public Member Functions | |
__construct (Controller $ctrl, string $model) | |
all (string $condition='', $included=false, array $parameters=[], bool $useCache=false, string $viewVar='all') | |
Load all instances in a view variable named all. | |
byId ($keyValues, $included=true, bool $useCache=false, string $viewVar='byId') | |
Load one instance by id in a view variable named byId. | |
one (string $condition='', $included=true, array $parameters=[], bool $useCache=false, string $viewVar='one') | |
Load one instance in a view variable named one. | |
insert (object $instance, $insertMany=false, string $viewVar='inserted') | |
Insert a new instance $instance into the database and add the instance in a view variable (inserted). | |
update (object $instance, $insertMany=false, string $viewVar='updated') | |
Update an instance $instance in the database and add the instance in a view variable (updated). | |
save (object $instance, $insertMany=false, string $viewVar='saved') | |
Save (insert or update) an instance $instance in the database and add the instance in a view variable (saved). | |
remove (object $instance, string $viewVar='removed') | |
Remove an instance $instance from the database and add the instance in a view variable. | |
Private Member Functions | |
setViewVarsAndReturn (string $viewVar, $instance, $r) | |
Private Attributes | |
string | $model |
View | $view |
A repository for managing CRUD operations on a model, displayed in a view.
Ubiquity\orm\repositories$ViewRepository This class is part of Ubiquity
Definition at line 18 of file ViewRepository.php.
__construct | ( | Controller | $ctrl, |
string | $model | ||
) |
Definition at line 28 of file ViewRepository.php.
all | ( | string | $condition = '' , |
$included = false , |
|||
array | $parameters = [ ] , |
||
bool | $useCache = false , |
||
string | $viewVar = 'all' |
||
) |
Load all instances in a view variable named all.
string | $condition | |
array | boolean | $included | |
array | $parameters | |
bool | $useCache | |
string | $viewVar |
Definition at line 43 of file ViewRepository.php.
byId | ( | $keyValues, | |
$included = true , |
|||
bool | $useCache = false , |
||
string | $viewVar = 'byId' |
||
) |
Load one instance by id in a view variable named byId.
$keyValues | ||
bool | array | $included | |
bool | $useCache | |
string | $viewVar |
Definition at line 57 of file ViewRepository.php.
insert | ( | object | $instance, |
$insertMany = false , |
|||
string | $viewVar = 'inserted' |
||
) |
Insert a new instance $instance into the database and add the instance in a view variable (inserted).
A status variable added to the view shows whether the operation was successful.
object | $instance | |
bool | $insertMany | |
string | $viewVar |
Exception
Definition at line 88 of file ViewRepository.php.
one | ( | string | $condition = '' , |
$included = true , |
|||
array | $parameters = [ ] , |
||
bool | $useCache = false , |
||
string | $viewVar = 'one' |
||
) |
Load one instance in a view variable named one.
string | $condition | |
bool | array | $included | |
array | $parameters | |
bool | $useCache | |
string | $viewVar |
Ubiquity\exceptions\DAOException
Definition at line 73 of file ViewRepository.php.
remove | ( | object | $instance, |
string | $viewVar = 'removed' |
||
) |
Remove an instance $instance from the database and add the instance in a view variable.
object | $instance | |
string | $viewVar |
Definition at line 128 of file ViewRepository.php.
save | ( | object | $instance, |
$insertMany = false , |
|||
string | $viewVar = 'saved' |
||
) |
Save (insert or update) an instance $instance in the database and add the instance in a view variable (saved).
A status variable added to the view shows whether the operation was successful.
object | $instance | |
bool | $insertMany | |
string | $viewVar |
Definition at line 116 of file ViewRepository.php.
|
private |
Definition at line 22 of file ViewRepository.php.
update | ( | object | $instance, |
$insertMany = false , |
|||
string | $viewVar = 'updated' |
||
) |
Update an instance $instance in the database and add the instance in a view variable (updated).
A status variable added to the view shows whether the operation was successful.
object | $instance | |
bool | $insertMany | |
string | $viewVar |
Definition at line 102 of file ViewRepository.php.
|
private |
Definition at line 19 of file ViewRepository.php.
|
private |
Definition at line 20 of file ViewRepository.php.