lox/pheasant — pull request #44 by lox (2013-03-25 07:11:16+00:00)
Title: System-wide events, and event bubbling from object->schema->system

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

Now there are three points for event registration:

* System-wide:

```php
Pheasant::instance()->events()->register('afterInitialize', function($event, $schema) {
// do some setup for the object
});
```
* Schema-specific

```php
Llamas::events()->register('beforeSave', function($event, $object) {
// do something before saving all Llama objects
});
```

* Instance-specific

```php
$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.