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
7a9a86a5
Commit
7a9a86a5
authored
Apr 17, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #310
parent
b81f399c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
9 deletions
+52
-9
Statement.php
lib/Doctrine/Db/Statement.php
+4
-0
Record.php
lib/Doctrine/Record.php
+23
-8
Table.php
lib/Doctrine/Table.php
+2
-1
StateTestCase.php
tests/Record/StateTestCase.php
+23
-0
No files found.
lib/Doctrine/Db/Statement.php
View file @
7a9a86a5
...
...
@@ -42,6 +42,10 @@ class Doctrine_Db_Statement implements Doctrine_Adapter_Statement_Interface
{
$this
->
adapter
=
$adapter
;
$this
->
stmt
=
$stmt
;
if
(
$stmt
===
false
)
{
throw
new
Doctrine_Db_Exception
(
'Unknown statement object given.'
);
}
}
/**
*
...
...
lib/Doctrine/Record.php
View file @
7a9a86a5
...
...
@@ -382,7 +382,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* @return integer
*/
private
function
cleanData
(
$debug
=
false
)
private
function
cleanData
()
{
$tmp
=
$this
->
_data
;
...
...
@@ -397,42 +397,57 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
_data
[
$name
]
=
self
::
$null
;
}
else
{
switch
(
$type
)
{
case
"array"
:
case
"object"
:
case
'array'
:
case
'object'
:
if
(
$tmp
[
$name
]
!==
self
::
$null
)
{
if
(
is_string
(
$tmp
[
$name
]))
{
$value
=
unserialize
(
$tmp
[
$name
]);
if
(
$value
===
false
)
throw
new
Doctrine_Record_Exception
(
"Unserialization of
$name
failed."
);
throw
new
Doctrine_Record_Exception
(
'Unserialization of '
.
$name
.
' failed.'
);
}
else
{
$value
=
$tmp
[
$name
];
}
$this
->
_data
[
$name
]
=
$value
;
}
break
;
case
"gzip"
:
case
'gzip'
:
if
(
$tmp
[
$name
]
!==
self
::
$null
)
{
$value
=
gzuncompress
(
$tmp
[
$name
]);
if
(
$value
===
false
)
throw
new
Doctrine_Record_Exception
(
"Uncompressing of
$name
failed."
);
throw
new
Doctrine_Record_Exception
(
'Uncompressing of '
.
$name
.
' failed.'
);
$this
->
_data
[
$name
]
=
$value
;
}
break
;
case
"enum"
:
case
'enum'
:
$this
->
_data
[
$name
]
=
$this
->
_table
->
enumValue
(
$name
,
$tmp
[
$name
]);
break
;
default
:
$this
->
_data
[
$name
]
=
$tmp
[
$name
];
}
;
}
$count
++
;
}
}
return
$count
;
}
/**
* hydrate
* hydrates this object from given array
*
* @param array $data
* @return boolean
*/
public
function
hydrate
(
array
$data
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$this
->
_data
[
$k
]
=
$v
;
}
$this
->
cleanData
();
$this
->
prepareIdentifiers
();
}
/**
* prepareIdentifiers
* prepares identifiers for later use
...
...
lib/Doctrine/Table.php
View file @
7a9a86a5
...
...
@@ -1144,6 +1144,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
if
(
isset
(
$this
->
identityMap
[
$id
]))
{
$record
=
$this
->
identityMap
[
$id
];
$record
->
hydrate
(
$this
->
data
);
}
else
{
$recordName
=
$this
->
getClassnameToReturn
();
$record
=
new
$recordName
(
$this
);
...
...
@@ -1183,7 +1184,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
break
;
}
}
if
(
!
$nomatch
)
{
if
(
!
$nomatch
)
{
return
$table
->
getComponentName
();
}
}
...
...
tests/Record/StateTestCase.php
View file @
7a9a86a5
...
...
@@ -107,4 +107,27 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_PROXY
);
}
public
function
testProxiesAreAutomaticallyUpdatedWithFetches
()
{
$user
=
new
User
();
$user
->
name
=
'someuser'
;
$user
->
password
=
'123'
;
$user
->
save
();
$this
->
connection
->
clear
();
$user
=
$this
->
connection
->
queryOne
(
"SELECT u.name FROM User u WHERE u.name = 'someuser'"
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_PROXY
);
$user2
=
$this
->
connection
->
queryOne
(
"FROM User u WHERE u.name = 'someuser'"
);
$this
->
assertEqual
(
$user
->
getOID
(),
$user2
->
getOID
());
$count
=
count
(
$this
->
dbh
);
$this
->
assertEqual
(
$user
->
password
,
'123'
);
$this
->
assertEqual
(
$count
,
count
(
$this
->
dbh
));
}
}
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