Ejemplo n.º 1
0
 protected static function doProcess($annotation, ClassMetadata $metadata)
 {
     if (is_string($annotation->custom)) {
         $annotation->custom = explode(',', $annotation->custom);
     }
     $metadata->setAccessorOrder($annotation->order, array_map('trim', (array) $annotation->custom));
 }
Ejemplo n.º 2
0
 public function testSetAccessorOrderAlphabetical()
 {
     $metadata = new ClassMetadata(new \ReflectionClass(PropertyMetadataOrder::class));
     $metadata->addAttributeMetadata(new PropertyMetadata(PropertyMetadataOrder::class, 'b'));
     $metadata->addAttributeMetadata(new PropertyMetadata(PropertyMetadataOrder::class, 'a'));
     $this->assertEquals(['b', 'a'], array_keys($metadata->getAttributesMetadata()));
     $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_ALPHABETICAL);
     $this->assertEquals(['a', 'b'], array_keys($metadata->getAttributesMetadata()));
 }