We have moved to Github. Please open tickets there.

Opened 18 months ago

Last modified 4 months ago

#4197 new Defect

'create' event trigger - create_entity vs create_object_entity

Reported by: ismayil.khayredinov Owned by:
Priority: normal Milestone: Elgg 1.10.0
Component: Core Version: 1.8.1
Severity: minor Keywords:
Cc: brett@… Difficulty:

Description (last modified by ewinslow)

Is there any particular reason to not call
elgg_trigger_event('create', $entity->type, $entity) in create_entity()?

It seems unreasonable inserting entity base information into the database and then deleting the entity if the event_handler says false. Perhaps it would be more rational to call elgg_trigger_event once in create_entity.

Change History (3)

comment:1 Changed 18 months ago by cash

When we trigger events/plugin hooks (and what we call them) needs to be reviewed. One thing we want to do in Elgg 1.9 is get away from having the data model classes calling functions. There is a lot of odd stuff like this:

function canEdit($user_guid = 0) {
    return can_edit_entity($this->getGUID(), $user_guid);
}

To your question, I think the goal is to wait until the object is fully created before triggering the event. We're thinking we need before/after events where the before is a plugin hook that lets you change/prevent the action. The after let's you know it happened.

comment:2 Changed 13 months ago by ewinslow

  • Description modified (diff)
  • Milestone changed from Needs Review to Elgg 1.9.0

comment:3 Changed 4 months ago by cash

  • Milestone changed from Elgg 1.9.0 to Elgg 1.10.0
Note: See TracTickets for help on using tickets.