1
0
mirror of synced 2025-02-02 21:41:45 +03:00

#6174 #5570 removed modifications applied to the CompanyContractListener, since UnitOfWorkTest now completely encapsulates the scenarios being covered

This commit is contained in:
Marco Pivetta 2016-12-18 15:48:10 +01:00
parent cfd595b699
commit 21a5d8ca1b

View File

@ -4,8 +4,6 @@ namespace Doctrine\Tests\Models\Company;
class CompanyContractListener
{
const PRE_PERSIST = 0;
public $postPersistCalls;
public $prePersistCalls;
@ -19,8 +17,6 @@ class CompanyContractListener
public $postLoadCalls;
public $snapshots = [];
/**
* @PostPersist
*/
@ -34,7 +30,6 @@ class CompanyContractListener
*/
public function prePersistHandler(CompanyContract $contract)
{
$this->snapshots[self::PRE_PERSIST][] = $this->takeSnapshot($contract);
$this->prePersistCalls[] = func_get_args();
}
@ -85,23 +80,4 @@ class CompanyContractListener
{
$this->postLoadCalls[] = func_get_args();
}
public function takeSnapshot(CompanyContract $contract)
{
$snapshot = [];
foreach ((new \ReflectionClass($contract))->getProperties() as $property) {
$property->setAccessible(true);
$value = $property->getValue($contract);
if (is_object($value) || is_array($value)) {
continue;
}
$snapshot[$property->getName()] = $property->getValue($contract);
}
return $snapshot;
}
}