1
0
mirror of synced 2025-02-01 04:51:45 +03:00

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

This commit is contained in:
jwage 2009-07-10 21:47:42 +00:00
parent ba8b4337bb
commit 1aeff68c0f
2 changed files with 27 additions and 4 deletions

View File

@ -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;
}
}

View 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 {