Commit Graph

152 Commits

Author SHA1 Message Date
Fabien Potencier
245ff6d7a8 updated composer.json for 2.1 2011-09-29 17:40:43 +02:00
Fabien Potencier
f5ab6ec934 Merge branch '2.0'
* 2.0:
  [composer] add missing deps for FrameworkBundle
  [composer] change ext/intl to the new ext-intl syntax
  [composer] fix monolog-bridge composer.json, add more inter-component deps
  [composer] add composer.json
2011-09-29 17:29:32 +02:00
Igor Wiedler
9ade639bb4 [composer] add composer.json 2011-09-27 00:55:43 +02:00
Jordan Alliot
5146a1f0d0 [EventDispatcher] Added possibility for subscribers to subscribe several times for same event
closes #2146
2011-09-16 18:13:00 +01:00
Jeremy Mikola
39fabab013 [EventDispatcher] Fix removeSubscriber() to work with priority syntax 2011-08-23 16:41:08 -04:00
Igor Wiedler
8d48cea9e1 [EventDispatcher] Change the license of EventDispatcher from LGPL to MIT
It was previously agreed to re-license the Doctrine2 based
EventDispatcher refactoring to use the MIT license. However, the files
still retain the LGPL license notice.

This commit changes the license to MIT.
2011-08-21 14:32:21 +02:00
Robert Campbell
72d71b52f2 Cleaned up unused code in Symfony\Component\EventDispatcher\EventDispatcher::getListeners() 2011-08-20 15:44:49 -05:00
Fabien Potencier
dd23402e94 [EventDispatcher] tweaked public @api 2011-06-14 14:40:48 +02:00
Fabien Potencier
c6cc427e4b [EventDispatcher] added a way to set the priority for event subscribers 2011-06-14 14:40:27 +02:00
Fabien Potencier
a2163f39ff [EventDispatcher] re-added the cache layer 2011-05-30 16:00:29 +02:00
Fabien Potencier
a3403e492e [EventDispatcher] removed unneeded code 2011-05-30 15:56:06 +02:00
Fabien Potencier
71411ba368 fixed typos 2011-05-30 13:53:50 +02:00
Fabien Potencier
90ca8e0404 fixed more unit tests 2011-05-30 09:19:01 +02:00
Fabien Potencier
f6b481a9ee [EventDispatcher] simplified code and fixed unit tests 2011-05-30 08:59:28 +02:00
Fabien Potencier
09a6e6759a [EventDispatcher] fixed notices 2011-05-30 08:59:22 +02:00
Jordi Boggiano
ba8758b4c2 [EventDispatcher] Removed temporary code 2011-05-26 11:56:59 +02:00
Jordi Boggiano
1246503e55 [EventDispatcher] Allow registration of arbitrary callbacks
This in effect removes the direct link between event name and the method name on the handler.
Any callback can be given as a handler and the event name becomes an arbitrary string. Allowing for easier namespacing (see next commit)
2011-05-26 11:54:06 +02:00
Jordi Boggiano
000229dbd0 [EventDispatcher] Remove useless code 2011-05-26 11:54:02 +02:00
Jordi Boggiano
9816b6adc3 [EventDispatcher] Minor memory optimization to getListeners() 2011-05-26 11:54:00 +02:00
Jordi Boggiano
48d6a95803 [FrameworkBundle] Small optimization, remove some function calls 2011-05-26 11:53:58 +02:00
Victor Berchet
745d144e79 [Event] Tweak phpDoc for consistency 2011-04-06 09:42:48 +02:00
Fabien Potencier
0f231c33e5 [EventDispatcher] tagged the guaranteed BC API 2011-03-24 10:06:26 +01:00
Fabien Potencier
bd8d2b829f [EventDispatcher] changed listener storage to use SplObjectStorage to avoid collisions 2011-03-18 18:48:26 +01:00
Fabien Potencier
136b23ead4 [EventDispatcher] refactored the code
* The array returned by getListeners() now removes the listener hash as the key (as this is an implementation detail)
 * The sort method now guarantees that a listener registered before another will stay in the same order even for the same priority (for BC)
 * Made various optimizations
2011-03-18 09:01:22 +01:00
Fabien Potencier
69d324eca8 [EventDispatcher] added EventDispatcher::removeSubscriber() 2011-03-18 09:00:58 +01:00
Fabien Potencier
10a02ff7fa [EventDispatcher] reverted to the old event dispatcher way of storing listeners 2011-03-18 08:09:42 +01:00
Fabien Potencier
59ac6313ad [EventDispatcher] made order deterministic (first registered one stay first) -- this makes the new system more compatible with the old one 2011-03-18 07:36:02 +01:00
Fabien Potencier
9d0b6f0012 fixed CS 2011-03-17 16:09:25 +01:00
Fabien Potencier
1219b98ec5 renamed some methods in the event dispatcher 2011-03-17 15:27:42 +01:00
Bernhard Schussek
06c682b4fb Switched from Doctrine's EventManager implementation to the EventManager clone in Symfony2 (now called EventDispatcher again) 2011-03-13 19:49:10 +01:00
Bernhard Schussek
699e046b4f [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation 2011-03-13 19:15:38 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Pascal Borreli
4f2f1c08a9 [EventDispatcher] Fixed typo 2011-02-26 20:02:06 +01:00
Fabien Potencier
f54cedfe5e added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +01:00
Fabien Potencier
93fc26d869 [EventDispatcher] simplified code (thanks Kris Wallsmith for the tip) 2011-02-04 00:29:28 +01:00
Bulat Shakirzyanov
799375dfd6 [EventDispatcher] removed unused class variable 2011-01-28 16:36:43 +01:00
Fabien Potencier
8b62df7247 changed the EventDispatcher and Event interfaces
The three notification methods do not return the Event instance anymore.

notify() does not return anything
notifyUntil() returns the returned value of the event that has processed the event
filter() returns the filtered value

Upgrading your listeners:
Listeners for notify() and filter() events: nothing to change
Listeners for notifyUntil() events:

Before:

    $event->setReturnValue('foo');
    return true;

After:

    $event->setProcessed();
    return 'foo';

If you notify events, the processing also need to be changed:

For filter() notifications: the filtered value is now available as
the returned value of the filter() method.

For notifyUntil() notifications:

Before:

    $event = $dispatcher->notifyUntil($event);
    if ($event->isProcessed()) {
        $ret = $event->getReturnValue();

        // do something with $ret
    }

After:

    $ret = $dispatcher->notifyUntil($event);
    if ($event->isProcessed()) {
        // do something with $ret
    }
2011-01-26 08:41:59 +01:00
Fabien Potencier
0e66e388ec added two interfaces: EventInterface and EventDispatcherInterface 2011-01-25 14:23:32 +01:00
Fabien Potencier
49793c22d4 fixed event dispatcher 2011-01-24 16:46:04 +01:00
Ryan Weaver
17f9162b89 [Standards] Changing many instances of "boolean" to "Boolean". 2011-01-21 09:53:24 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Fabien Potencier
b47cf7984b changed priority meaning to be more intuitive 2011-01-14 14:37:32 +01:00
Johannes M. Schmitt
eef6578c15 fixes bugs due to not disconnected listeners 2010-12-08 08:14:33 +01:00
Fabien Potencier
944d91c1df made some method name changes to have a better coherence throughout the framework
When an object has a "main" many relation with related "things" (objects,
parameters, ...), the method names are normalized:

 * get()
 * set()
 * all()
 * replace()
 * remove()
 * clear()
 * isEmpty()
 * add()
 * register()
 * count()
 * keys()

The classes below follow this method naming convention:

 * BrowserKit\CookieJar -> Cookie
 * BrowserKit\History -> Request
 * Console\Application -> Command
 * Console\Application\Helper\HelperSet -> HelperInterface
 * DependencyInjection\Container -> services
 * DependencyInjection\ContainerBuilder -> services
 * DependencyInjection\ParameterBag\ParameterBag -> parameters
 * DependencyInjection\ParameterBag\FrozenParameterBag -> parameters
 * DomCrawler\Form -> FormField
 * EventDispatcher\Event -> parameters
 * Form\FieldGroup -> Field
 * HttpFoundation\HeaderBag -> headers
 * HttpFoundation\ParameterBag -> parameters
 * HttpFoundation\Session -> attributes
 * HttpKernel\Profiler\Profiler -> DataCollectorInterface
 * Routing\RouteCollection -> Route
 * Security\Authentication\AuthenticationProviderManager -> AuthenticationProviderInterface
 * Templating\Engine -> HelperInterface
 * Translation\MessageCatalogue -> messages

The usage of these methods are only allowed when it is clear that there is a
main relation:

 * a CookieJar has many Cookies;

 * a Container has many services and many parameters (as services is the main
   relation, we use the naming convention for this relation);

 * a Console Input has many arguments and many options. There is no "main"
   relation, and so the naming convention does not apply.

For many relations where the convention does not apply, the following methods
must be used instead (where XXX is the name of the related thing):

 * get()      -> getXXX()
 * set()      -> setXXX()
 * all()      -> getXXXs()
 * replace()  -> setXXXs()
 * remove()   -> removeXXX()
 * clear()    -> clearXXX()
 * isEmpty()  -> isEmptyXXX()
 * add()      -> addXXX()
 * register() -> registerXXX()
 * count()    -> countXXX()
 * keys()
2010-11-25 17:30:06 +01:00
Fabien Potencier
4e5c99dab0 [EventDispatcher] removed the possibility to remove one listener for an event 2010-11-15 23:14:36 +01:00
Kris Wallsmith
f79e23ffb5 Removed all those spaces after @author that were bothering me so… 2010-10-18 16:55:41 +02:00
Fabien Potencier
2b8dfe1ccf [EventDispatcher] fixed possible PHP warning 2010-10-13 07:44:14 +02:00
Benjamin Zikarsky
d376596f7e [EventDispatcher] fixed bug in EventDispatcher::disconnect if the second argument is null or ommitted 2010-10-13 07:41:56 +02:00
Jordi Boggiano
bf1eb56a34 [EventDispatched] Event doesn't need to implement ArrayAccess 2010-10-06 14:33:52 +02:00
Fabien Potencier
2d04ca3443 [EventDispatcher] added a way to disconnect all listeners for an event name 2010-09-01 11:10:31 +02:00
Fabien Potencier
82ff79064a added a priority to the event dispatcher listeners 2010-08-26 14:08:42 +02:00
Fabien Potencier
bf82cf42dd renamed Symfony\Components to Symfony\Component 2010-08-20 23:09:55 +02:00