Permalink
Browse files

Added filter to reflection

  • Loading branch information...
1 parent 2e9fed8 commit f18cd402e007cabf3d00d0c213563ff509b98fc2 @iwalz committed Jan 8, 2013
Showing with 6 additions and 1 deletion.
  1. +3 −0 library/Zend/Stdlib/Hydrator/Reflection.php
  2. +3 −1 tests/ZendTest/Stdlib/HydratorTest.php
@@ -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);
@@ -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;
@@ -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 f18cd40

Please sign in to comment.