getSchema($this->getOption(self::OPTION_PERSISTENCE)); $table = $schema->createTable(self::NOTIFICATION_TABLE); $table->addColumn(self::NOTIFICATION_FIELD_ID, 'string', ['length' => 36, 'notnull' => true]); $table->addColumn(self::NOTIFICATION_FIELD_RECIPIENT, 'string', ['length' => 255, 'notnull' => true]); $table->addColumn(self::NOTIFICATION_FIELD_STATUS, 'integer', ['length' => 255]); $table->addColumn(self::NOTIFICATION_FIELD_TITLE, 'string', ['length' => 255]); $table->addColumn(self::NOTIFICATION_FIELD_MESSAGE, 'text', []); $table->addColumn(self::NOTIFICATION_FIELD_SENDER, 'string', ['length' => 255]); $table->addColumn(self::NOTIFICATION_FIELD_SENDER_NAME, 'string', ['length' => 255]); $table->addColumn(self::NOTIFICATION_FIELD_CREATION, 'datetime', ['notnull' => true]); $table->addColumn(self::NOTIFICATION_FIELD_UPDATED, 'datetime', ['notnull' => true]); $table->setPrimaryKey([self::NOTIFICATION_FIELD_ID]); } /** * @throws Exception */ protected function prepareNotification(Notification $notification): array { /** @var AbstractPlatform $platform */ $platform = $this->getPersistence()->getPlatForm(); return [ self::NOTIFICATION_FIELD_ID => $this->getUniquePrimaryKey(), self::NOTIFICATION_FIELD_RECIPIENT => $notification->getRecipient(), self::NOTIFICATION_FIELD_STATUS => $notification->getStatus(), self::NOTIFICATION_FIELD_SENDER => $notification->getSenderId(), self::NOTIFICATION_FIELD_SENDER_NAME => $notification->getSenderName(), self::NOTIFICATION_FIELD_TITLE => $notification->getTitle(), self::NOTIFICATION_FIELD_MESSAGE => $notification->getMessage(), self::NOTIFICATION_FIELD_CREATION => $platform->getNowExpression(), self::NOTIFICATION_FIELD_UPDATED => $platform->getNowExpression(), ]; } }