From: Michael Date: Mon, 1 Feb 2021 13:36:20 +0000 (+0000) Subject: Fixed class name X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=32e6b28aabf5e77ff4bcad1c6f0704eac59211a4;p=friendica.git Fixed class name --- diff --git a/src/Model/Post/UserNotifcation.php b/src/Model/Post/UserNotifcation.php deleted file mode 100644 index 5dca875aba..0000000000 --- a/src/Model/Post/UserNotifcation.php +++ /dev/null @@ -1,99 +0,0 @@ -. - * - */ - -namespace Friendica\Model\Post; - -use \BadMethodCallException; -use Friendica\Database\Database; -use Friendica\Database\DBA; -use Friendica\Database\DBStructure; - -class UserNotification -{ - /** - * Insert a new user notification entry - * - * @param integer $uri_id - * @param integer $uid - * @param array $fields - * @return bool success - * @throws \Exception - */ - public static function insert(int $uri_id, int $uid, array $data = []) - { - if (empty($uri_id)) { - throw new BadMethodCallException('Empty URI_id'); - } - - $fields = DBStructure::getFieldsForTable('post-user-notification', $data); - - // Additionally assign the key fields - $fields['uri-id'] = $uri_id; - $fields['uid'] = $uid; - - return DBA::insert('post-user-notification', $fields, Database::INSERT_IGNORE); - } - - /** - * Update a user notification entry - * - * @param integer $uri_id - * @param integer $uid - * @param array $data - * @param bool $insert_if_missing - * @return bool - * @throws \Exception - */ - public static function update(int $uri_id, int $uid, array $data = [], bool $insert_if_missing = false) - { - if (empty($uri_id)) { - throw new BadMethodCallException('Empty URI_id'); - } - - $fields = DBStructure::getFieldsForTable('post-user-notification', $data); - - // Remove the key fields - unset($fields['uri-id']); - unset($fields['uid']); - - if (empty($fields)) { - return true; - } - - return DBA::update('post-user-notification', $fields, ['uri-id' => $uri_id, 'uid' => $uid], $insert_if_missing ? true : []); - } - - /** - * Delete a row from the post-user-notification table - * - * @param array $conditions Field condition(s) - * @param array $options - * - cascade: If true we delete records in other tables that depend on the one we're deleting through - * relations (default: true) - * - * @return boolean was the delete successful? - * @throws \Exception - */ - public static function delete(array $conditions, array $options = []) - { - return DBA::delete('post-user-notification', $conditions, $options); - } -} diff --git a/src/Model/Post/UserNotification.php b/src/Model/Post/UserNotification.php new file mode 100644 index 0000000000..5dca875aba --- /dev/null +++ b/src/Model/Post/UserNotification.php @@ -0,0 +1,99 @@ +. + * + */ + +namespace Friendica\Model\Post; + +use \BadMethodCallException; +use Friendica\Database\Database; +use Friendica\Database\DBA; +use Friendica\Database\DBStructure; + +class UserNotification +{ + /** + * Insert a new user notification entry + * + * @param integer $uri_id + * @param integer $uid + * @param array $fields + * @return bool success + * @throws \Exception + */ + public static function insert(int $uri_id, int $uid, array $data = []) + { + if (empty($uri_id)) { + throw new BadMethodCallException('Empty URI_id'); + } + + $fields = DBStructure::getFieldsForTable('post-user-notification', $data); + + // Additionally assign the key fields + $fields['uri-id'] = $uri_id; + $fields['uid'] = $uid; + + return DBA::insert('post-user-notification', $fields, Database::INSERT_IGNORE); + } + + /** + * Update a user notification entry + * + * @param integer $uri_id + * @param integer $uid + * @param array $data + * @param bool $insert_if_missing + * @return bool + * @throws \Exception + */ + public static function update(int $uri_id, int $uid, array $data = [], bool $insert_if_missing = false) + { + if (empty($uri_id)) { + throw new BadMethodCallException('Empty URI_id'); + } + + $fields = DBStructure::getFieldsForTable('post-user-notification', $data); + + // Remove the key fields + unset($fields['uri-id']); + unset($fields['uid']); + + if (empty($fields)) { + return true; + } + + return DBA::update('post-user-notification', $fields, ['uri-id' => $uri_id, 'uid' => $uid], $insert_if_missing ? true : []); + } + + /** + * Delete a row from the post-user-notification table + * + * @param array $conditions Field condition(s) + * @param array $options + * - cascade: If true we delete records in other tables that depend on the one we're deleting through + * relations (default: true) + * + * @return boolean was the delete successful? + * @throws \Exception + */ + public static function delete(array $conditions, array $options = []) + { + return DBA::delete('post-user-notification', $conditions, $options); + } +}