thelia-modules / TheliaStudio

Module that adds tools for Thelia developpers
3 stars 3 forks source link

Consolidate the event constants #7

Closed gillesbourgeat closed 9 years ago

gillesbourgeat commented 9 years ago

Hello,

Consolidate the event constants

Exemple for :

Current structure :

Bookstore
    Event
        BookEvents
        AuthorEvents
        PublishingHouse

New structure :

Bookstore
    Event
        BookstoreEvents
namespace Bookstore\Event\Base;

/**
 * Class BookstoreEvents
 * @package Bookstore\Event\Base
 * @author YourFather :)
 */
class BookstoreEvents
{
    const BOOK_CREATE = "action.bookstore.book.create";
    const BOOK_UPDATE = "action.bookstore.book.update";
    const BOOK_DELETE = "action.bookstore.book.delete";
    const AUTHOR_CREATE = "action.bookstore.author.create";
    const AUTHOR_UPDATE = "action.bookstore.author.update";
    const AUTHOR_DELETE = "action.bookstore.author.delete";
    const PUBLISHING_HOUSE_CREATE = "action.bookstore.publishing_house.create";
    const PUBLISHING_HOUSE_UPDATE = "action.bookstore.publishing_house.update";
    const PUBLISHING_HOUSE_DELETE = "action.bookstore.publishing_house.delete";
}

Cheers,

lovenunu commented 9 years ago

There are two approches for this problem. Some consider that each table should have it's own events class, some one for a module. Both can be included too. But we can't delete previous implementation as it would be BC.