f66e109d14
* 2.2: Fixed XmlFileLoaderTest::testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation moved file hash calculation to own method [Validator] Add check for existing metadata on property added support for the X-Forwarded-For header (closes #6982, closes #7000) fixed the IP address in HttpCache when calling the backend [EventDispatcher] Added assertion. [EventDispathcer] Fix removeListener [DependencyInjection] Add clone for resources which were introduced in 2.1 [DependencyInjection] Allow frozen containers to be dumped to graphviz Fix 'undefined index' error, when entering scope recursively [Security] fixed session creation on login (closes #7011) replaced usage of the deprecated pattern routing key (replaced with path) Add dot character `.` to legal mime subtype regular expression [HttpFoundation] fixed the creation of sub-requests under some circumstancies (closes #6923, closes #6936) |
||
---|---|---|
.. | ||
Debug | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
ContainerAwareEventDispatcher.php | ||
Event.php | ||
EventDispatcher.php | ||
EventDispatcherInterface.php | ||
EventSubscriberInterface.php | ||
GenericEvent.php | ||
ImmutableEventDispatcher.php | ||
LICENSE | ||
phpunit.xml.dist | ||
README.md |
EventDispatcher Component
EventDispatcher implements a lightweight version of the Observer design pattern.
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
$dispatcher = new EventDispatcher();
$dispatcher->addListener('event_name', function (Event $event) {
// ...
});
$dispatcher->dispatch('event_name');
Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/EventDispatcher/
$ composer.phar install --dev
$ phpunit