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
5f1c8d10
Commit
5f1c8d10
authored
Aug 21, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
a0958f7d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
Table.php
Doctrine/Table.php
+22
-22
No files found.
Doctrine/Table.php
View file @
5f1c8d10
...
...
@@ -44,9 +44,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
private
$query
;
/**
* @var Doctrine_
Session $session Doctrine_Sess
ion object that created this table
* @var Doctrine_
Connection $connection Doctrine_Connect
ion object that created this table
*/
private
$
sess
ion
;
private
$
connect
ion
;
/**
* @var string $name name of the component, for example component name of the GroupTable is 'Group'
*/
...
...
@@ -111,14 +111,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
/**
* the constructor
* @throws Doctrine_ManagerException if there are no opened
sess
ions
* @throws Doctrine_ManagerException if there are no opened
connect
ions
* @throws Doctrine_TableException if there is already an instance of this table
* @return void
*/
public
function
__construct
(
$name
)
{
$this
->
session
=
Doctrine_Manager
::
getInstance
()
->
getCurrentSess
ion
();
$this
->
connection
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnect
ion
();
$this
->
setParent
(
$this
->
sess
ion
);
$this
->
setParent
(
$this
->
connect
ion
);
$this
->
name
=
$name
;
...
...
@@ -206,7 +206,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
endswitch
;
if
(
Doctrine_DataDict
::
isValidClassname
(
$class
->
getName
())
&&
$this
->
getAttribute
(
Doctrine
::
ATTR_CREATE_TABLES
))
{
$dict
=
new
Doctrine_DataDict
(
$this
->
get
Sess
ion
()
->
getDBH
());
$dict
=
new
Doctrine_DataDict
(
$this
->
get
Connect
ion
()
->
getDBH
());
$dict
->
createTable
(
$this
->
tableName
,
$this
->
columns
);
}
...
...
@@ -224,7 +224,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$this
->
query
=
"SELECT "
.
implode
(
", "
,
array_keys
(
$this
->
columns
))
.
" FROM "
.
$this
->
getTableName
();
// check if an instance of this table is already initialized
if
(
!
$this
->
sess
ion
->
addTable
(
$this
))
if
(
!
$this
->
connect
ion
->
addTable
(
$this
))
throw
new
Doctrine_Table_Exception
();
$this
->
initComponents
();
...
...
@@ -501,10 +501,10 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
return
$this
->
name
;
}
/**
* @return Doctrine_
Sess
ion
* @return Doctrine_
Connect
ion
*/
final
public
function
get
Sess
ion
()
{
return
$this
->
sess
ion
;
final
public
function
get
Connect
ion
()
{
return
$this
->
connect
ion
;
}
/**
* @return Doctrine_Cache
...
...
@@ -551,7 +551,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$alias
=
$name
;
$name
=
$this
->
bound
[
$alias
][
3
];
$table
=
$this
->
sess
ion
->
getTable
(
$name
);
$table
=
$this
->
connect
ion
->
getTable
(
$name
);
if
(
$component
==
$this
->
name
||
in_array
(
$component
,
$this
->
parents
))
{
...
...
@@ -597,7 +597,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
if
(
$e2
[
0
]
!=
$component
)
throw
new
Doctrine_Mapping_Exception
(
$e2
[
0
]
.
" doesn't match "
.
$component
);
$associationTable
=
$this
->
sess
ion
->
getTable
(
$e2
[
0
]);
$associationTable
=
$this
->
connect
ion
->
getTable
(
$e2
[
0
]);
if
(
count
(
$fields
)
>
1
)
{
// SELF-REFERENCING THROUGH JOIN TABLE
...
...
@@ -683,7 +683,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$params
=
array_merge
(
$id
,
array_values
(
$this
->
inheritanceMap
));
$stmt
=
$this
->
sess
ion
->
execute
(
$query
,
$params
);
$stmt
=
$this
->
connect
ion
->
execute
(
$query
,
$params
);
$this
->
data
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
);
...
...
@@ -715,7 +715,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
* @return Doctrine_Collection
*/
public
function
findAll
()
{
$graph
=
new
Doctrine_Query
(
$this
->
sess
ion
);
$graph
=
new
Doctrine_Query
(
$this
->
connect
ion
);
$users
=
$graph
->
query
(
"FROM "
.
$this
->
name
);
return
$users
;
}
...
...
@@ -729,7 +729,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
* @return Doctrine_Collection
*/
public
function
findBySql
(
$dql
,
array
$params
=
array
())
{
$q
=
new
Doctrine_Query
(
$this
->
sess
ion
);
$q
=
new
Doctrine_Query
(
$this
->
connect
ion
);
$users
=
$q
->
query
(
"FROM "
.
$this
->
name
.
" WHERE "
.
$dql
,
$params
);
return
$users
;
}
...
...
@@ -791,7 +791,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$params
=
array_merge
(
array
(
$id
),
array_values
(
$this
->
inheritanceMap
));
$this
->
data
=
$this
->
sess
ion
->
execute
(
$query
,
$params
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
$this
->
data
=
$this
->
connect
ion
->
execute
(
$query
,
$params
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
if
(
$this
->
data
===
false
)
throw
new
Doctrine_Find_Exception
();
...
...
@@ -811,14 +811,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
* @return integer
*/
public
function
count
()
{
$a
=
$this
->
sess
ion
->
getDBH
()
->
query
(
"SELECT COUNT(1) FROM "
.
$this
->
tableName
)
->
fetch
(
PDO
::
FETCH_NUM
);
$a
=
$this
->
connect
ion
->
getDBH
()
->
query
(
"SELECT COUNT(1) FROM "
.
$this
->
tableName
)
->
fetch
(
PDO
::
FETCH_NUM
);
return
current
(
$a
);
}
/**
* @return Doctrine_Query a Doctrine_Query object
*/
public
function
getQueryObject
()
{
$graph
=
new
Doctrine_Query
(
$this
->
get
Sess
ion
());
$graph
=
new
Doctrine_Query
(
$this
->
get
Connect
ion
());
$graph
->
load
(
$this
->
getComponentName
());
return
$graph
;
}
...
...
@@ -831,12 +831,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
public
function
execute
(
$query
,
array
$array
=
array
(),
$limit
=
null
,
$offset
=
null
)
{
$coll
=
new
Doctrine_Collection
(
$this
);
$query
=
$this
->
sess
ion
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
$query
=
$this
->
connect
ion
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
if
(
!
empty
(
$array
))
{
$stmt
=
$this
->
sess
ion
->
getDBH
()
->
prepare
(
$query
);
$stmt
=
$this
->
connect
ion
->
getDBH
()
->
prepare
(
$query
);
$stmt
->
execute
(
$array
);
}
else
{
$stmt
=
$this
->
sess
ion
->
getDBH
()
->
query
(
$query
);
$stmt
=
$this
->
connect
ion
->
getDBH
()
->
query
(
$query
);
}
$data
=
$stmt
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
$stmt
->
closeCursor
();
...
...
@@ -944,7 +944,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
final
public
function
getMaxIdentifier
()
{
$sql
=
"SELECT MAX("
.
$this
->
getIdentifier
()
.
") FROM "
.
$this
->
getTableName
();
$stmt
=
$this
->
sess
ion
->
getDBH
()
->
query
(
$sql
);
$stmt
=
$this
->
connect
ion
->
getDBH
()
->
query
(
$sql
);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_NUM
);
return
isset
(
$data
[
0
])
?
$data
[
0
]
:
1
;
}
...
...
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