public function testCachedMetadataFromFactory() { $cache = new ArrayCache(); $this->factory = new ClassMetadataFactory($this->loader, $cache); $metadata = $this->factory->getClassMetadata('DMS\\Tests\\Dummy\\Classes\\AnnotatedClass'); $this->assertTrue($cache->contains(ltrim('DMS\\Tests\\Dummy\\Classes\\AnnotatedClass', '\\'))); //Get new Factory to retrieve from cache $this->factory = new ClassMetadataFactory($this->loader, $cache); $metadataCached = $this->factory->getClassMetadata('DMS\\Tests\\Dummy\\Classes\\AnnotatedClass'); $this->assertEquals($metadata, $metadataCached); }
/** * Iterates over annotated properties in an object filtering the selected * values * * @param object $object * @param string $limitProperty */ protected function walkObject($object, $limitProperty = null) { if ($object === null) { return; } $metadata = $this->metadataFactory->getClassMetadata(get_class($object)); //Get a Object Handler/Walker $walker = new ObjectWalker($object, $this->filterLoader); //Get all filtered properties or limit with selected $properties = $limitProperty !== null ? array($limitProperty) : $metadata->getFilteredProperties(); //Iterate over properties with filters foreach ($properties as $property) { $walker->applyFilterRules($property, $metadata->getPropertyRules($property)); } }