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:
parent
810699b454
commit
1b4e3564a5
11 changed files with 983 additions and 3 deletions
58
src/Navigation/Notifications/Factory/Notify.php
Normal file
58
src/Navigation/Notifications/Factory/Notify.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Navigation\Notifications\Factory;
|
||||
|
||||
use Friendica\BaseFactory;
|
||||
use Friendica\Capabilities\ICanCreateFromTableRow;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
|
||||
class Notify extends BaseFactory implements ICanCreateFromTableRow
|
||||
{
|
||||
public function createFromTableRow(array $row): \Friendica\Navigation\Notifications\Entity\Notify
|
||||
{
|
||||
return new \Friendica\Navigation\Notifications\Entity\Notify(
|
||||
$row['type'],
|
||||
$row['name'],
|
||||
new Uri($row['url']),
|
||||
new Uri($row['photo']),
|
||||
new \DateTime($row['date'], new \DateTimeZone('UTC')),
|
||||
$row['uid'],
|
||||
new Uri($row['link']),
|
||||
$row['seen'],
|
||||
$row['verb'],
|
||||
$row['otype'],
|
||||
$row['name_cache'],
|
||||
$row['msg'],
|
||||
$row['msg_cache'],
|
||||
$row['iid'],
|
||||
$row['uri-id'],
|
||||
$row['parent'],
|
||||
$row['parent-uri-id'],
|
||||
$row['id']
|
||||
);
|
||||
}
|
||||
|
||||
public function createFromParams($params, $itemlink = null, $item_id = null, $uri_id = null, $parent_id = null, $parent_uri_id = null): \Friendica\Navigation\Notifications\Entity\Notify
|
||||
{
|
||||
return new \Friendica\Navigation\Notifications\Entity\Notify(
|
||||
$params['type'] ?? '',
|
||||
$params['source_name'] ?? '',
|
||||
new Uri($params['source_link'] ?? ''),
|
||||
new Uri($params['source_photo'] ?? ''),
|
||||
new \DateTime(),
|
||||
$params['uid'] ?? 0,
|
||||
new Uri($itemlink ?? ''),
|
||||
false,
|
||||
$params['verb'] ?? '',
|
||||
$params['otype'] ?? '',
|
||||
substr(strip_tags(BBCode::convertForUriId($uri_id, $params['source_name'])), 0, 255),
|
||||
null,
|
||||
null,
|
||||
$item_id,
|
||||
$uri_id,
|
||||
$parent_id,
|
||||
$parent_uri_id
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue