diff --git a/src/AnnotationGenerator/ApiPlatformCoreAnnotationGenerator.php b/src/AnnotationGenerator/ApiPlatformCoreAnnotationGenerator.php index c5366b3a..61a45fcf 100644 --- a/src/AnnotationGenerator/ApiPlatformCoreAnnotationGenerator.php +++ b/src/AnnotationGenerator/ApiPlatformCoreAnnotationGenerator.php @@ -29,7 +29,7 @@ public function generateClassAnnotations($className) { $resource = $this->classes[$className]['resource']; - return [sprintf('@Resource(iri="%s")', $resource->getUri())]; + return [sprintf('@ApiResource(iri="%s")', $resource->getUri())]; } /** @@ -37,7 +37,7 @@ public function generateClassAnnotations($className) */ public function generateFieldAnnotations($className, $fieldName) { - return $this->classes[$className]['fields'][$fieldName]['isCustom'] ? [] : [sprintf('@Property(iri="http://schema.org/%s")', $fieldName)]; + return $this->classes[$className]['fields'][$fieldName]['isCustom'] ? [] : [sprintf('@ApiProperty(iri="http://schema.org/%s")', $fieldName)]; } /** @@ -50,6 +50,6 @@ public function generateUses($className) $subClassOf = $resource->get('rdfs:subClassOf'); $typeIsEnum = $subClassOf && $subClassOf->getUri() === TypesGenerator::SCHEMA_ORG_ENUMERATION; - return $typeIsEnum ? [] : ['ApiPlatform\Core\Annotation\Resource', 'ApiPlatform\Core\Annotation\Property']; + return $typeIsEnum ? [] : ['ApiPlatform\Core\Annotation\ApiResource', 'ApiPlatform\Core\Annotation\ApiProperty']; } } diff --git a/tests/AnnotationGenerator/ApiPlatformCoreAnnotationGeneratorTest.php b/tests/AnnotationGenerator/ApiPlatformCoreAnnotationGeneratorTest.php index ac94a64b..20bb14fa 100644 --- a/tests/AnnotationGenerator/ApiPlatformCoreAnnotationGeneratorTest.php +++ b/tests/AnnotationGenerator/ApiPlatformCoreAnnotationGeneratorTest.php @@ -51,18 +51,18 @@ public function setUp() public function testGenerateClassAnnotations() { - $this->assertSame(['@Resource(iri="http://schema.org/Res")'], $this->generator->generateClassAnnotations('Res')); + $this->assertSame(['@ApiResource(iri="http://schema.org/Res")'], $this->generator->generateClassAnnotations('Res')); } public function testGenerateFieldAnnotations() { - $this->assertSame(['@Property(iri="http://schema.org/prop")'], $this->generator->generateFieldAnnotations('Res', 'prop')); + $this->assertSame(['@ApiProperty(iri="http://schema.org/prop")'], $this->generator->generateFieldAnnotations('Res', 'prop')); $this->assertSame([], $this->generator->generateFieldAnnotations('Res', 'customProp')); } public function testGenerateUses() { - $this->assertSame(['ApiPlatform\Core\Annotation\Resource', 'ApiPlatform\Core\Annotation\Property'], $this->generator->generateUses('Res')); + $this->assertSame(['ApiPlatform\Core\Annotation\ApiResource', 'ApiPlatform\Core\Annotation\ApiProperty'], $this->generator->generateUses('Res')); $this->assertSame([], $this->generator->generateUses('MyEnum')); } }