| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Giancarlo
- * Date: 29/08/2018
- * Time: 16:36
- */
- namespace OpenMind\System;
- use DB\SQL\Mapper;
- class Notifications extends Mapper
- {
- /** @var \Base $f3 */
- private $f3;
- // Used internally
- private $initLoad;
- public function __construct()
- {
- global $f3;
- $this->f3 = $f3;
- parent::__construct($f3->get('DB'), 'notifications');
- $this->count = 'count(code)';
- }
- /**
- * Retrieve notifications
- *
- * @return array|FALSE
- */
- public function check()
- {
- if (!$this->initLoad) {
- $this->initLoad = true;
- $this->load();
- }
- return $this->dry();
- }
- /**
- * @param int $code of notification to remove from database
- */
- public function Remove(int $code)
- {
- $this->reset();
- $this->erase(['code=?', $code]);
- }
- /**
- * Truncate all table
- */
- public function emptyAll()
- {
- $this->f3->get('DB')->exec('TRUNCATE TABLE notifications');
- }
- }
|