Commit 1aeff68c authored by jwage's avatar jwage

[2.0] Initial commit to make hydration work with C extension

parent ba8b4337
......@@ -47,7 +47,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
'metadataDriverImpl' => new AnnotationDriver(),
'dqlClassAliasMap' => array(),
'cacheDir' => null,
'allowPartialObjects' => true
'allowPartialObjects' => true,
'useCExtension' => false
));
}
......@@ -186,4 +187,14 @@ class Configuration extends \Doctrine\DBAL\Configuration
{
$this->_attributes['metadataCacheImpl'] = $cacheImpl;
}
public function getUseCExtension()
{
return $this->_attributes['useCExtension'];
}
public function setUseCExtension($boolean)
{
$this->_attributes['useCExtension'] = $boolean;
}
}
\ No newline at end of file
......@@ -204,6 +204,13 @@ class UnitOfWork implements PropertyChangedListener
*/
private $_collectionPersisters = array();
/**
* Flag for whether or not to use the C extension for hydration
*
* @var string
*/
private $_useCExtension = false;
/**
* Initializes a new UnitOfWork instance, bound to the given EntityManager.
*
......@@ -214,6 +221,7 @@ class UnitOfWork implements PropertyChangedListener
$this->_em = $em;
//TODO: any benefit with lazy init?
$this->_commitOrderCalculator = new CommitOrderCalculator();
$this->_useCExtension = $this->_em->getConfiguration()->getUseCExtension();
}
/**
......@@ -1334,9 +1342,13 @@ class UnitOfWork implements PropertyChangedListener
}
if ($overrideLocalChanges) {
foreach ($data as $field => $value) {
if (isset($class->reflFields[$field])) {
$class->reflFields[$field]->setValue($entity, $value);
if ($this->_useCExtension) {
doctrine_populate_data($entity, $data);
} else {
foreach ($data as $field => $value) {
if (isset($class->reflFields[$field])) {
$class->reflFields[$field]->setValue($entity, $value);
}
}
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment