Add new paradigm classes for notify

- Create BaseDepository class
- Create Entity, Collection, Factory and Depository classes
- Create FormattedNotification Entity, Collection and Factory to remove business logic from Notify repository
- Create new NotificationCreationIntercepted exception to allow addons to cancel notification creation
- Remove unused frio notifications/notify.tpl template
This commit is contained in:
Hypolite Petovan 2021-08-28 21:55:04 -04:00
parent 810699b454
commit 1b4e3564a5
11 changed files with 983 additions and 3 deletions

View file

@ -22,12 +22,11 @@
namespace Friendica;
/**
* The Collection classes inheriting from this abstract class are meant to represent a list of database record.
* The associated model class has to be provided in the child classes.
* The Collection classes inheriting from this class are meant to represent a list of structured objects of a single type.
*
* Collections can be used with foreach(), accessed like an array and counted.
*/
abstract class BaseCollection extends \ArrayIterator
class BaseCollection extends \ArrayIterator
{
/**
* This property is used with paginated results to hold the total number of items satisfying the paginated request.
@ -115,4 +114,14 @@ abstract class BaseCollection extends \ArrayIterator
{
return new static(array_filter($this->getArrayCopy(), $callback, $flag));
}
/**
* Reverse the orders of the elements in the collection
*
* @return $this
*/
public function reverse(): BaseCollection
{
return new static(array_reverse($this->getArrayCopy()), $this->getTotalCount());
}
}