Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
75ea33ac
Commit
75ea33ac
authored
Feb 18, 2014
by
Alexander Mohorev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mongodb method "open" not triggered event "after open connection"
parent
e1b55153
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Connection.php
extensions/mongodb/Connection.php
+17
-0
No files found.
extensions/mongodb/Connection.php
View file @
75ea33ac
...
@@ -73,6 +73,11 @@ use Yii;
...
@@ -73,6 +73,11 @@ use Yii;
class
Connection
extends
Component
class
Connection
extends
Component
{
{
/**
/**
* @event Event an event that is triggered after a DB connection is established
*/
const
EVENT_AFTER_OPEN
=
'afterOpen'
;
/**
* @var string host:port
* @var string host:port
*
*
* Correct syntax is:
* Correct syntax is:
...
@@ -233,6 +238,7 @@ class Connection extends Component
...
@@ -233,6 +238,7 @@ class Connection extends Component
$options
[
'db'
]
=
$this
->
defaultDatabaseName
;
$options
[
'db'
]
=
$this
->
defaultDatabaseName
;
}
}
$this
->
mongoClient
=
new
\MongoClient
(
$this
->
dsn
,
$options
);
$this
->
mongoClient
=
new
\MongoClient
(
$this
->
dsn
,
$options
);
$this
->
initConnection
();
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
__METHOD__
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
__METHOD__
);
...
@@ -253,4 +259,14 @@ class Connection extends Component
...
@@ -253,4 +259,14 @@ class Connection extends Component
$this
->
_databases
=
[];
$this
->
_databases
=
[];
}
}
}
}
/**
* Initializes the DB connection.
* This method is invoked right after the DB connection is established.
* The default implementation triggers an [[EVENT_AFTER_OPEN]] event.
*/
protected
function
initConnection
()
{
$this
->
trigger
(
self
::
EVENT_AFTER_OPEN
);
}
}
}
\ No newline at end of file
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