namespace OCA\FilesReminders\Command;
-use DateTime;
use DateTimeInterface;
use OC\Core\Command\Base;
use OCA\FilesReminders\Model\RichReminder;
fn (RichReminder $reminder) => [
$reminder->getUserId(),
$reminder->getNode()->getPath(),
- DateTime::createFromFormat('U', (string)$reminder->getRemindAt())->format(DateTimeInterface::ATOM), // ISO 8601
+ $reminder->getRemindAt()->format(DateTimeInterface::ATOM), // ISO 8601
$reminder->getNotified() ? 'true' : 'false',
],
$reminders,
namespace OCA\FilesReminders\Db;
+use DateTime;
use OCP\AppFramework\Db\Entity;
/**
* @method void setFileId(int $fileId)
* @method int getFileId()
*
- * @method void setRemindAt(int $remindAt)
- * @method int getRemindAt()
+ * @method void setRemindAt(DateTime $remindAt)
+ * @method DateTime getRemindAt()
*
* @method void setNotified(bool $notified)
* @method bool getNotified()
public function __construct() {
$this->addType('userId', 'string');
$this->addType('fileId', 'integer');
- $this->addType('remindAt', 'integer');
+ $this->addType('remindAt', 'datetime');
$this->addType('notified', 'boolean');
}
}
$table->addColumn('file_id', Types::BIGINT, [
'notnull' => true,
'length' => 20,
+ 'unsigned' => true,
]);
- $table->addColumn('remind_at', Types::BIGINT, [
- 'notnull' => true,
+ $table->addColumn('remind_at', Types::DATETIME, [
+ 'notnull' => false,
]);
$table->addColumn('notified', Types::BOOLEAN, [
'notnull' => false,
->setUser($user->getUID())
->setObject('reminder', (string)$reminder->getId())
->setSubject('reminder-due')
- ->setDateTime(DateTime::createFromFormat('U', (string)$reminder->getRemindAt()));
+ ->setDateTime($reminder->getRemindAt());
try {
$this->notificationManager->notify($notification);