Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

System-wide events, and event bubbling from object->schema->system #44

Merged
merged 1 commit into from
Mar 25, 2013

Conversation

lox
Copy link
Owner

@lox lox commented Mar 25, 2013

Added an new event: beforeInitialize(schemaBuilder) and afterInitialize(schema)

Now there are three points for event registration:

  • System-wide:
Pheasant::instance()->events()->register('afterInitialize', function($event, $schema) {
   // do some setup for the object
});
  • Schema-specific
Llamas::events()->register('beforeSave', function($event, $object) {
   // do something before saving all Llama objects
});
  • Instance-specific
$llama = new Llama();
$llama->events()->register('beforeSave', function($event, $object) {
   // do some setup for the object
});

The interesting thing about this system is it bubbles. Events are fired at the most granular possible level and they bubble upwards, eventually ending up at the system event handler.

lox added a commit that referenced this pull request Mar 25, 2013
System-wide events, and event bubbling from object->schema->system
@lox lox merged commit 8874ccb into master Mar 25, 2013
@bjornpost bjornpost deleted the event-bubbling branch April 27, 2015 14:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant