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
411779d1
Commit
411779d1
authored
Jul 05, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
660f8323
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
Table.php
lib/Doctrine/Table.php
+63
-0
No files found.
lib/Doctrine/Table.php
View file @
411779d1
...
...
@@ -1153,6 +1153,69 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
{
return
$this
->
data
;
}
/**
* prepareValue
* this method performs special data preparation depending on
* the type of the given column
*
* 1. It unserializes array and object typed columns
* 2. Uncompresses gzip typed columns
* 3. Gets the appropriate enum values for enum typed columns
* 4. Initializes special null object pointer for null values (for fast column existence checking purposes)
*
* example:
* <code type='php'>
* $field = 'name';
* $value = null;
* $table->prepareValue($field, $value); // Doctrine_Null
* </code>
*
* @throws Doctrine_Table_Exception if unserialization of array/object typed column fails or
* @throws Doctrine_Table_Exception if uncompression of gzip typed column fails *
* @param string $field the name of the field
* @param string $value field value
* @return mixed prepared value
*/
public
function
prepareValue
(
$field
,
$value
)
{
if
(
$value
===
null
)
{
return
self
::
$_null
;
}
else
{
$type
=
$this
->
getTypeOf
(
$field
);
switch
(
$type
)
{
case
'array'
:
case
'object'
:
if
(
is_string
(
$value
))
{
$value
=
unserialize
(
$value
);
if
(
$value
===
false
)
{
throw
new
Doctrine_Table_Exception
(
'Unserialization of '
.
$field
.
' failed.'
);
}
return
$value
;
}
break
;
case
'gzip'
:
$value
=
gzuncompress
(
$value
);
if
(
$value
===
false
)
{
throw
new
Doctrine_Table_Exception
(
'Uncompressing of '
.
$field
.
' failed.'
);
}
return
$value
;
break
;
case
'enum'
:
return
$this
->
enumValue
(
$field
,
$value
);
break
;
case
'boolean'
:
return
(
boolean
)
$value
;
break
;
case
'integer'
:
return
(
int
)
$value
;
break
;
}
}
return
$value
;
}
/**
* getter for associated tree
*
...
...
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