Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Best way to build Notification System
  • Hi,
    I have different type of notifications. (Friend Request, Message, Comment etc..) I have builded two database. One of them holds the type of notifications. Another one is storing notifications type and the content of notifications.
    Here is the problem;
    I'm serializing all the content. For example, for comments; user_id,post_id
    When i need it, i'm deserializing this informations and put them in a sentences writing to screen also sending mail. But i have a feeling that this serializing methodology can be problematic for the further.. I really like FuelPHP ORM. I want to use ORM also. But to use it, I have to separate every notification type to its table.. I need your suggestions.
    Thank you.
    -Tevfik.
    Here is the database tables that I wrote; CREATE TABLE `notification_type` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `notifications` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `user_id` int(11) unsigned NOT NULL,
    `type_id` int(11) unsigned NOT NULL,
    `content` text NOT NULL,
    PRIMARY KEY (`id`),
    KEY `user_id` (`user_id`),
    KEY `type_id` (`type_id`),
    CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `notifications_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `notification_type` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!