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
99037abd
Commit
99037abd
authored
May 22, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
146b215d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
17 deletions
+31
-17
Connection.php
lib/Doctrine/Connection.php
+2
-1
Record.php
lib/Doctrine/Record.php
+26
-14
Association.php
lib/Doctrine/Relation/Association.php
+1
-1
Parser.php
lib/Doctrine/Relation/Parser.php
+2
-1
No files found.
lib/Doctrine/Connection.php
View file @
99037abd
...
...
@@ -229,7 +229,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
}
}
else
{
if
(
is_bool
(
$item
))
{
$item
=
(
int
)
$item
;
$item
=
(
int
)
$item
;
}
}
return
$item
;
...
...
@@ -696,6 +696,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
}
catch
(
Doctrine_Adapter_Exception
$e
)
{
}
catch
(
PDOException
$e
)
{
}
$this
->
rethrowException
(
$e
);
}
/**
...
...
lib/Doctrine/Record.php
View file @
99037abd
...
...
@@ -432,10 +432,12 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$vars
=
get_object_vars
(
$this
);
unset
(
$vars
[
'references'
]);
unset
(
$vars
[
'originals'
]);
unset
(
$vars
[
'_references'
]);
unset
(
$vars
[
'_table'
]);
unset
(
$vars
[
'_errorStack'
]);
unset
(
$vars
[
'_filter'
]);
unset
(
$vars
[
'_modified'
]);
unset
(
$vars
[
'_node'
]);
$name
=
$this
->
_table
->
getIdentifier
();
$this
->
_data
=
array_merge
(
$this
->
_data
,
$this
->
_id
);
...
...
@@ -476,18 +478,19 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$manager
=
Doctrine_Manager
::
getInstance
();
$connection
=
$manager
->
getConnectionForComponent
(
get_class
(
$this
));
$this
->
oid
=
self
::
$
index
;
self
::
$index
++
;
$this
->
_oid
=
self
::
$_
index
;
self
::
$
_
index
++
;
$this
->
_table
=
$connection
->
getTable
(
get_class
(
$this
));
$array
=
unserialize
(
$serialized
);
foreach
(
$array
as
$name
=>
$values
)
{
$this
->
$
name
=
$values
;
foreach
(
$array
as
$k
=>
$v
)
{
$this
->
$
k
=
$v
;
}
$this
->
_table
->
getRepository
()
->
add
(
$this
);
$this
->
_filter
=
new
Doctrine_Record_Filter
(
$this
);
$this
->
_data
=
$this
->
_filter
->
cleanData
(
$this
->
_data
);
...
...
@@ -575,7 +578,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
!
$this
->
_data
)
{
throw
new
Doctrine_Record_Exception
(
'Failed to refresh. Record does not exist anymore'
);
}
$this
->
_data
=
array_change_key_case
(
$this
->
_data
,
CASE_LOWER
);
$this
->
_modified
=
array
();
...
...
@@ -596,7 +599,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @throws Doctrine_Record_Exception When the primary key of this record doesn't match the primary key fetched from a collection
* @return void
*/
final
public
function
factoryRefresh
()
public
function
factoryRefresh
()
{
$this
->
_data
=
$this
->
_table
->
getData
();
$old
=
$this
->
_id
;
...
...
@@ -619,7 +622,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* @return object Doctrine_Table a Doctrine_Table object
*/
final
public
function
getTable
()
public
function
getTable
()
{
return
$this
->
_table
;
}
...
...
@@ -629,7 +632,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* @return array an array containing all the properties
*/
final
public
function
getData
()
public
function
getData
()
{
return
$this
->
_data
;
}
...
...
@@ -1352,13 +1355,22 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*/
public
function
countRelated
(
$name
)
{
$rel
=
$this
->
_table
->
getRelation
(
$name
);
$componentName
=
$rel
->
getTable
()
->
getComponentName
();
$alias
=
$rel
->
getTable
()
->
getAlias
(
get_class
(
$this
));
$query
=
new
Doctrine_Query
();
$query
->
from
(
$componentName
.
'('
.
'COUNT(1)'
.
')'
)
->
where
(
$componentName
.
'.'
.
$alias
.
'.'
.
$this
->
getTable
()
->
getIdentifier
()
.
' = ?'
);
$array
=
$query
->
execute
(
array
(
$this
->
getIncremented
()));
/**
$query->select('COUNT(p.id)')
->from($componentName)
->where($componentName. '.' . $rel->getAlias()
. '.' . $this->getTable()->getIdentifier(). ' = ?');
*/
//$array = $query->execute(array($this->getIncremented()));
return
0
;
return
$array
[
0
][
'COUNT(1)'
];
}
/**
* merge
...
...
lib/Doctrine/Relation/Association.php
View file @
99037abd
...
...
@@ -58,7 +58,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
switch
(
$context
)
{
case
"record"
:
$sub
=
'SQL:SELECT '
.
$this
->
definition
[
'foreign'
]
.
' FROM '
.
$this
->
definition
[
'
assoc
Table'
]
->
getTableName
()
.
' FROM '
.
$this
->
definition
[
'
ref
Table'
]
->
getTableName
()
.
' WHERE '
.
$this
->
definition
[
'local'
]
.
' IN ('
.
substr
(
str_repeat
(
"?, "
,
$count
),
0
,
-
2
)
.
')'
;
...
...
lib/Doctrine/Relation/Parser.php
View file @
99037abd
...
...
@@ -328,7 +328,7 @@ class Doctrine_Relation_Parser
if
(
$table2
->
hasColumn
(
$column
))
{
$def
[
'foreign'
]
=
$column
;
$def
[
'local'
]
=
$table
->
getIdentifier
();
$def
[
'localKey'
]
=
true
;
return
$def
;
}
}
...
...
@@ -344,6 +344,7 @@ class Doctrine_Relation_Parser
if
(
$table2
->
hasColumn
(
$column
))
{
$def
[
'foreign'
]
=
$table
->
getIdentifier
();
$def
[
'local'
]
=
$column
;
$def
[
'localKey'
]
=
true
;
return
$def
;
}
}
...
...
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