Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Added filter to reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalz committed Jan 8, 2013
1 parent 53e39bb commit b185085
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions library/Zend/Stdlib/Hydrator/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function extract($object)
$result = array();
foreach (self::getReflProperties($object) as $property) {
$propertyName = $property->getName();
if (!$this->filterComposite->filter($propertyName)) {
continue;
}

$value = $property->getValue($object);
$result[$propertyName] = $this->extractValue($propertyName, $value);
Expand Down
4 changes: 3 additions & 1 deletion tests/ZendTest/Stdlib/HydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use ZendTest\Stdlib\TestAsset\ClassMethodsUnderscore;
use ZendTest\Stdlib\TestAsset\ClassMethodsCamelCaseMissing;
use ZendTest\Stdlib\TestAsset\Reflection as ReflectionAsset;
use ZendTest\Stdlib\TestAsset\ReflectionFilter;
use ZendTest\Stdlib\TestAsset\ObjectProperty as ObjectPropertyAsset;
use ZendTest\Stdlib\TestAsset\ArraySerializable as ArraySerializableAsset;
use Zend\Stdlib\Hydrator\Strategy\DefaultStrategy;
Expand Down Expand Up @@ -363,7 +364,8 @@ public function filterProvider()
{
return array(
array(new ObjectProperty(), new ObjectPropertyAsset),
array(new ArraySerializable(), new ArraySerializableAsset)
array(new ArraySerializable(), new ArraySerializableAsset),
array(new Reflection(), new ReflectionFilter)
);
}
}

0 comments on commit b185085

Please sign in to comment.