ApiPlatform\SchemaGenerator\AnnotationGenerator\ApiPlatformCoreAnnotationGenerator::generateUses PHP Method

generateUses() public method

public generateUses ( $className )
    public function generateUses($className)
    {
        $resource = $this->classes[$className]['resource'];
        $subClassOf = $resource->get('rdfs:subClassOf');
        $typeIsEnum = $subClassOf && $subClassOf->getUri() === TypesGenerator::SCHEMA_ORG_ENUMERATION;
        return $typeIsEnum ? [] : ['ApiPlatform\\Core\\Annotation\\ApiResource', 'ApiPlatform\\Core\\Annotation\\ApiProperty'];
    }

Usage Example

 public function testGenerateUses()
 {
     $this->assertSame(['ApiPlatform\\Core\\Annotation\\ApiResource', 'ApiPlatform\\Core\\Annotation\\ApiProperty'], $this->generator->generateUses('Res'));
     $this->assertSame([], $this->generator->generateUses('MyEnum'));
 }