Commit b6642e2d authored by romanb's avatar romanb

moved event stuff

parent 0ef216a9
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::Common::Event;
#namespace Doctrine::Common;
/**
* The EventManager is the central point of Doctrine's event listener system.
......@@ -30,7 +30,7 @@
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @since 2.0
*/
class Doctrine_EventManager
class Doctrine_Common_EventManager
{
/**
* Map of registered listeners.
......@@ -107,7 +107,7 @@ class Doctrine_EventManager
*
* @param Doctrine::Common::Event::EventSubscriber $subscriber The subscriber.
*/
public function addEventSubscriber(Doctrine_EventSubscriber $subscriber)
public function addEventSubscriber(Doctrine_Common_EventSubscriber $subscriber)
{
$this->addEventListener($subscriber->getSubscribedEvents(), $subscriber);
}
......
<?php
/*
* $Id: EventListener.php 4653 2008-07-10 17:17:58Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::Common;
/**
* An EventSubscriber knows itself what events it is interested in.
* If an EventSubscriber is added to an EventManager, the manager invokes
* getSubscribedEvents() and registers the subscriber as a listener for all
* returned events.
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 2.0
* @version $Revision: 4653 $
*/
interface Doctrine_Common_EventSubscriber
{
public function getSubscribedEvents();
}
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Events;
#namespace Doctrine::Common::Events;
/**
* Doctrine_Event
......@@ -32,7 +32,7 @@
* @since 2.0
* @version $Revision$
*/
class Doctrine_Event
class Doctrine_Common_Events_Event
{
/* Event callback constants */
const preDelete = 'preDelete';
......
......@@ -175,7 +175,7 @@ class Doctrine_Connection
$this->_config = new Doctrine_Configuration();
}
if ( ! $eventManager) {
$this->_eventManager = new Doctrine_EventManager();
$this->_eventManager = new Doctrine_Common_EventManager();
}
// create platform
......
......@@ -59,14 +59,14 @@ class Doctrine_ConnectionFactory
* @return Connection
*/
public function createConnection(array $params, Doctrine_Configuration $config = null,
Doctrine_EventManager $eventManager = null)
Doctrine_Common_EventManager $eventManager = null)
{
// create default config and event manager, if not set
if ( ! $config) {
$config = new Doctrine_Configuration();
}
if ( ! $eventManager) {
$eventManager = new Doctrine_EventManager();
$eventManager = new Doctrine_Common_EventManager();
}
// check for existing pdo object
......
......@@ -149,7 +149,7 @@ class Doctrine_EntityManager
* @param string $name
*/
protected function __construct(Doctrine_Connection $conn, $name, Doctrine_Configuration $config,
Doctrine_EventManager $eventManager)
Doctrine_Common_EventManager $eventManager)
{
$this->_conn = $conn;
$this->_name = $name;
......
......@@ -11,7 +11,7 @@ class Doctrine_OrmTestSuite extends Doctrine_TestSuite
protected function setUp()
{
$config = new Doctrine_Configuration();
$eventManager = new Doctrine_EventManager();
$eventManager = new Doctrine_Common_EventManager();
$connectionOptions = array(
'driverClass' => 'Doctrine_ConnectionMock',
'user' => 'john',
......
......@@ -34,13 +34,13 @@ class Doctrine_EntityManagerMock extends Doctrine_EntityManager
* @return unknown
*/
public static function create($conn, $name, Doctrine_Configuration $config = null,
Doctrine_EventManager $eventManager = null)
Doctrine_Common_EventManager $eventManager = null)
{
if (is_null($config)) {
$config = new Doctrine_Configuration();
}
if (is_null($eventManager)) {
$eventManager = new Doctrine_EventManager();
$eventManager = new Doctrine_Common_EventManager();
}
return new Doctrine_EntityManagerMock($conn, $name, $config, $eventManager);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment