parent
dac1a16964
commit
12e8ab216a
@ -89,17 +89,19 @@ class CompanyContractListener
|
|||||||
public function takeSnapshot(CompanyContract $contract)
|
public function takeSnapshot(CompanyContract $contract)
|
||||||
{
|
{
|
||||||
$snapshot = [];
|
$snapshot = [];
|
||||||
$reflexion = new \ReflectionClass($contract);
|
|
||||||
foreach ($reflexion->getProperties() as $property) {
|
foreach ((new \ReflectionClass($contract))->getProperties() as $property) {
|
||||||
$property->setAccessible(true);
|
$property->setAccessible(true);
|
||||||
|
|
||||||
$value = $property->getValue($contract);
|
$value = $property->getValue($contract);
|
||||||
|
|
||||||
if (is_object($value) || is_array($value)) {
|
if (is_object($value) || is_array($value)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$snapshot[$property->getName()] = $property->getValue($contract);
|
$snapshot[$property->getName()] = $property->getValue($contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $snapshot;
|
return $snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user