Skip to content

Commit

Permalink
[skip ci]{orm] add count to AbstractRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Apr 23, 2022
1 parent 9695d72 commit 51c2943
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Nothing

## [2.4.12] 2022-04-20
## [2.4.12] 2022-04-24
### Added
- `count` method to `AbstractRepository`
- app methods to Logger: `appLog`, `appInfo`, `appError`...
- regenerateId for `USession`
- `DataFormHelper` class for model form generation
Expand Down
13 changes: 12 additions & 1 deletion src/Ubiquity/orm/repositories/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This class is part of Ubiquity
*
* @author jc
* @version 1.0.1
* @version 1.0.2
*
*/
abstract class AbstractRepository {
Expand Down Expand Up @@ -101,4 +101,15 @@ public function save(object $instance, $insertMany = false) {
public function remove(object $instance): ?int {
return DAO::remove ( $instance );
}

/**
* Returns the number of instances.
*
* @param string $condition
* @param array $parameters
* @return int
*/
public function count(string $condition='',?array $parameters=null):int {
return DAO::count($this->getModel(),$condition,$parameters);
}
}

0 comments on commit 51c2943

Please sign in to comment.