public function testSerialization() { $storage = new AclAnnotationStorage(); $storage->add(new AclAnnotation(['id' => 'annotation', 'type' => 'entity']), 'Acme\\SomeClass', 'SomeMethod'); $this->assertEquals('annotation', $storage->findById('annotation')->getId()); $this->assertEquals('annotation', $storage->find('Acme\\SomeClass', 'SomeMethod')->getId()); $data = serialize($storage); $storage = unserialize($data); $this->assertEquals('annotation', $storage->findById('annotation')->getId()); $this->assertEquals('annotation', $storage->find('Acme\\SomeClass', 'SomeMethod')->getId()); }
/** * Gets an annotation bound to the given class/method * * @param string $class * @param string|null $method * @return AclAnnotation|null AclAnnotation object or null if ACL annotation was not found */ public function findAnnotation($class, $method = null) { $this->ensureAnnotationsLoaded(); return $this->storage->find($class, $method); }