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
f44784d9
Commit
f44784d9
authored
May 16, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made all manager variables protected and adhere to Zend naming conventions
parent
5d3660f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
54 deletions
+55
-54
Compiler.php
lib/Doctrine/Compiler.php
+1
-0
Manager.php
lib/Doctrine/Manager.php
+54
-54
No files found.
lib/Doctrine/Compiler.php
View file @
f44784d9
...
...
@@ -167,6 +167,7 @@ class Doctrine_Compiler
'RawSql'
,
'Record'
,
'Record_Exception'
,
'Record_Filter'
,
'Record_Iterator'
,
'Record_State_Exception'
,
'Relation'
,
...
...
lib/Doctrine/Manager.php
View file @
f44784d9
...
...
@@ -36,35 +36,35 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
/**
* @var array $connections an array containing all the opened connections
*/
pr
ivate
$
connections
=
array
();
pr
otected
$_
connections
=
array
();
/**
* @var array $bound an array containing all components that have a bound connection
*/
pr
ivate
$
bound
=
array
();
pr
otected
$_
bound
=
array
();
/**
* @var integer $index the incremented index
*/
pr
ivate
$
index
=
0
;
pr
otected
$_
index
=
0
;
/**
* @var integer $currIndex the current connection index
*/
pr
ivate
$
currIndex
=
0
;
pr
otected
$_
currIndex
=
0
;
/**
* @var string $root root directory
*/
pr
ivate
$
root
;
pr
otected
$_
root
;
/**
* @var Doctrine_Null $null Doctrine_Null object, used for extremely fast null value checking
*/
pr
ivate
$
null
;
pr
otected
$_
null
;
/**
* @var array $driverMap
*/
pr
ivate
$
driverMap
=
array
(
'oracle'
=>
'oci8'
,
'postgres'
=>
'pgsql'
,
'oci'
=>
'oci8'
,
'sqlite2'
=>
'sqlite'
,
'sqlite3'
=>
'sqlite'
);
pr
otected
$_
driverMap
=
array
(
'oracle'
=>
'oci8'
,
'postgres'
=>
'pgsql'
,
'oci'
=>
'oci8'
,
'sqlite2'
=>
'sqlite'
,
'sqlite3'
=>
'sqlite'
);
/**
* constructor
*
...
...
@@ -72,21 +72,21 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
private
function
__construct
()
{
$this
->
root
=
dirname
(
__FILE__
);
$this
->
null
=
new
Doctrine_Null
;
$this
->
_
root
=
dirname
(
__FILE__
);
$this
->
_
null
=
new
Doctrine_Null
;
Doctrine_Record
::
initNullObject
(
$this
->
null
);
Doctrine_Collection
::
initNullObject
(
$this
->
null
);
Doctrine_Record_Iterator
::
initNullObject
(
$this
->
null
);
Doctrine_Validator
::
initNullObject
(
$this
->
null
);
Doctrine_Record_Filter
::
initNullOjbect
(
$this
->
null
);
Doctrine_Record
::
initNullObject
(
$this
->
_
null
);
Doctrine_Collection
::
initNullObject
(
$this
->
_
null
);
Doctrine_Record_Iterator
::
initNullObject
(
$this
->
_
null
);
Doctrine_Validator
::
initNullObject
(
$this
->
_
null
);
Doctrine_Record_Filter
::
initNullOjbect
(
$this
->
_
null
);
}
/**
* @return Doctrine_Null
*/
final
public
function
getNullObject
()
{
return
$this
->
null
;
return
$this
->
_
null
;
}
/**
* setDefaultAttributes
...
...
@@ -94,7 +94,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*
* @return boolean
*/
final
public
function
setDefaultAttributes
()
public
function
setDefaultAttributes
()
{
static
$init
=
false
;
if
(
!
$init
)
{
...
...
@@ -135,7 +135,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
final
public
function
getRoot
()
{
return
$this
->
root
;
return
$this
->
_
root
;
}
/**
* getInstance
...
...
@@ -199,49 +199,49 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
if
(
$name
!==
null
)
{
$name
=
(
string
)
$name
;
if
(
isset
(
$this
->
connections
[
$name
]))
{
return
$this
->
connections
[
$name
];
if
(
isset
(
$this
->
_
connections
[
$name
]))
{
return
$this
->
_
connections
[
$name
];
}
}
else
{
$name
=
$this
->
index
;
$this
->
index
++
;
$name
=
$this
->
_
index
;
$this
->
_
index
++
;
}
switch
(
$adapter
->
getAttribute
(
Doctrine
::
ATTR_DRIVER_NAME
))
{
case
'mysql'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Mysql
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Mysql
(
$this
,
$adapter
);
break
;
case
'sqlite'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Sqlite
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Sqlite
(
$this
,
$adapter
);
break
;
case
'pgsql'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Pgsql
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Pgsql
(
$this
,
$adapter
);
break
;
case
'oci'
:
case
'oracle'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Oracle
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Oracle
(
$this
,
$adapter
);
break
;
case
'mssql'
:
case
'dblib'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Mssql
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Mssql
(
$this
,
$adapter
);
break
;
case
'firebird'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Firebird
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Firebird
(
$this
,
$adapter
);
break
;
case
'informix'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Informix
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Informix
(
$this
,
$adapter
);
break
;
case
'mock'
:
$this
->
connections
[
$name
]
=
new
Doctrine_Connection_Mock
(
$this
,
$adapter
);
$this
->
_
connections
[
$name
]
=
new
Doctrine_Connection_Mock
(
$this
,
$adapter
);
break
;
default
:
throw
new
Doctrine_Manager_Exception
(
'Unknown connection driver '
.
$adapter
->
getAttribute
(
Doctrine
::
ATTR_DRIVER_NAME
));
};
if
(
$setCurrent
)
{
$this
->
currIndex
=
$name
;
$this
->
_
currIndex
=
$name
;
}
return
$this
->
connections
[
$name
];
return
$this
->
_
connections
[
$name
];
}
/**
* getConnection
...
...
@@ -251,11 +251,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getConnection
(
$name
)
{
if
(
!
isset
(
$this
->
connections
[
$name
]))
{
if
(
!
isset
(
$this
->
_
connections
[
$name
]))
{
throw
new
Doctrine_Manager_Exception
(
'Unknown connection: '
.
$name
);
}
return
$this
->
connections
[
$name
];
return
$this
->
_
connections
[
$name
];
}
/**
* getComponentAlias
...
...
@@ -297,7 +297,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getConnectionName
(
Doctrine_Connection
$conn
)
{
return
array_search
(
$conn
,
$this
->
connections
,
true
);
return
array_search
(
$conn
,
$this
->
_
connections
,
true
);
}
/**
* bindComponent
...
...
@@ -311,7 +311,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
bindComponent
(
$componentName
,
$connectionName
)
{
$this
->
bound
[
$componentName
]
=
$connectionName
;
$this
->
_
bound
[
$componentName
]
=
$connectionName
;
}
/**
* getConnectionForComponent
...
...
@@ -321,8 +321,8 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getConnectionForComponent
(
$componentName
=
null
)
{
if
(
isset
(
$this
->
bound
[
$componentName
]))
{
return
$this
->
getConnection
(
$this
->
bound
[
$componentName
]);
if
(
isset
(
$this
->
_
bound
[
$componentName
]))
{
return
$this
->
getConnection
(
$this
->
_
bound
[
$componentName
]);
}
return
$this
->
getCurrentConnection
();
}
...
...
@@ -349,12 +349,12 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
{
$connection
->
close
();
$key
=
array_search
(
$connection
,
$this
->
connections
,
true
);
$key
=
array_search
(
$connection
,
$this
->
_
connections
,
true
);
if
(
$key
!==
false
)
{
unset
(
$this
->
connections
[
$key
]);
unset
(
$this
->
_
connections
[
$key
]);
}
$this
->
currIndex
=
key
(
$this
->
connections
);
$this
->
_currIndex
=
key
(
$this
->
_
connections
);
unset
(
$connection
);
}
...
...
@@ -366,7 +366,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getConnections
()
{
return
$this
->
connections
;
return
$this
->
_
connections
;
}
/**
* setCurrentConnection
...
...
@@ -379,10 +379,10 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
public
function
setCurrentConnection
(
$key
)
{
$key
=
(
string
)
$key
;
if
(
!
isset
(
$this
->
connections
[
$key
]))
{
if
(
!
isset
(
$this
->
_
connections
[
$key
]))
{
throw
new
InvalidKeyException
();
}
$this
->
currIndex
=
$key
;
$this
->
_
currIndex
=
$key
;
}
/**
* contains
...
...
@@ -393,7 +393,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
contains
(
$key
)
{
return
isset
(
$this
->
connections
[
$key
]);
return
isset
(
$this
->
_
connections
[
$key
]);
}
/**
* count
...
...
@@ -403,7 +403,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
count
()
{
return
count
(
$this
->
connections
);
return
count
(
$this
->
_
connections
);
}
/**
* getIterator
...
...
@@ -413,7 +413,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
connections
);
return
new
ArrayIterator
(
$this
->
_
connections
);
}
/**
* getCurrentConnection
...
...
@@ -424,11 +424,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public
function
getCurrentConnection
()
{
$i
=
$this
->
currIndex
;
if
(
!
isset
(
$this
->
connections
[
$i
]))
{
$i
=
$this
->
_
currIndex
;
if
(
!
isset
(
$this
->
_
connections
[
$i
]))
{
throw
new
Doctrine_Connection_Exception
();
}
return
$this
->
connections
[
$i
];
return
$this
->
_
connections
[
$i
];
}
/**
* __toString
...
...
@@ -440,7 +440,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
{
$r
[]
=
"<pre>"
;
$r
[]
=
"Doctrine_Manager"
;
$r
[]
=
"Connections : "
.
count
(
$this
->
connections
);
$r
[]
=
"Connections : "
.
count
(
$this
->
_
connections
);
$r
[]
=
"</pre>"
;
return
implode
(
"
\n
"
,
$r
);
}
...
...
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