Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e905680f
Commit
e905680f
authored
Jul 04, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New component: Doctrine_EventListener_Chain
parent
5471e9e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
1 deletion
+58
-1
Configurable.php
Doctrine/Configurable.php
+5
-1
Chain.php
Doctrine/EventListener/Chain.php
+52
-0
Debugger.php
Doctrine/EventListener/Debugger.php
+1
-0
No files found.
Doctrine/Configurable.php
View file @
e905680f
...
...
@@ -118,8 +118,12 @@ abstract class Doctrine_Configurable {
* @param Doctrine_EventListener $listener
* @return void
*/
final
public
function
setEventListener
(
Doctrine_EventListener
$listener
)
{
final
public
function
setEventListener
(
$listener
)
{
$i
=
Doctrine
::
ATTR_LISTENER
;
if
(
!
(
$listener
instanceof
Doctrine_EventListener
)
&&
!
(
$listener
instanceof
Doctrine_EventListener_Chain
))
throw
new
Doctrine_Exception
(
"EventListener must extend Doctrine_EventListener or Doctrine_EventListener_Chain"
);
$this
->
attributes
[
$i
]
=
$listener
;
}
/**
...
...
Doctrine/EventListener/Chain.php
0 → 100644
View file @
e905680f
<?php
class
Doctrine_EvenListener_Chain
extends
Doctrine_Access
{
/**
* @var array $listeners
*/
private
$listeners
=
array
();
/**
* add
*
* @param Doctrine_EventListener $listener
* @return void
*/
public
function
add
(
Doctrine_EventListener
$listener
)
{
$this
->
listeners
[]
=
$listener
;
}
/**
* returns a Doctrine_EvenListener on success
* and null on failure
*
* @param mixed $key
* @return mixed
*/
public
function
get
(
$key
)
{
if
(
!
isset
(
$this
->
listeners
[
$key
]))
return
null
;
return
$this
->
listeners
[
$key
];
}
/**
* set
*
* @param mixed $key
* @param Doctrine_EventListener $listener
* @return void
*/
public
function
set
(
$key
,
Doctrine_EventListener
$listener
)
{
$this
->
listeners
[
$key
]
=
$listener
;
}
/**
* this method should only be called internally by
* doctrine, since it doesn't do any method existence checking
*
* @param method $method
* @param array $args
*/
public
function
__call
(
$method
,
$args
)
{
foreach
(
$this
->
listeners
as
$listener
)
{
$listener
->
$method
(
$args
[
0
]);
}
}
}
?>
Doctrine/EventListener/Debugger.php
View file @
e905680f
...
...
@@ -16,6 +16,7 @@ class Doctrine_DebugMessage {
}
}
class
Doctrine_EventListener_Debugger
extends
Doctrine_EventListener
{
const
EVENT_LOAD
=
1
;
const
EVENT_PRELOAD
=
2
;
const
EVENT_SLEEP
=
3
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment