Skip to content

Commit 7e278be

Browse files
committed
Merge pull request #544 from Simperfit/hotfix/property-to-apiproporty
hotfix: Change @Property annotation to @ApiProperty
2 parents 515f56a + 446add1 commit 7e278be

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

src/Annotation/Property.php renamed to src/Annotation/ApiProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @Annotation
2020
* @Target({"METHOD", "PROPERTY"})
2121
*/
22-
final class Property
22+
final class ApiProperty
2323
{
2424
/**
2525
* @var string

src/Metadata/Property/Factory/AnnotationPropertyMetadataFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace ApiPlatform\Core\Metadata\Property\Factory;
1313

14-
use ApiPlatform\Core\Annotation\Property;
14+
use ApiPlatform\Core\Annotation\ApiProperty;
1515
use ApiPlatform\Core\Exception\PropertyNotFoundException;
1616
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
1717
use ApiPlatform\Core\Util\Reflection;
@@ -54,7 +54,7 @@ public function create(string $resourceClass, string $property, array $options =
5454
}
5555

5656
if ($reflectionClass->hasProperty($property)) {
57-
$annotation = $this->reader->getPropertyAnnotation($reflectionClass->getProperty($property), Property::class);
57+
$annotation = $this->reader->getPropertyAnnotation($reflectionClass->getProperty($property), ApiProperty::class);
5858

5959
if (null !== $annotation) {
6060
return $this->createMetadata($annotation, $parentPropertyMetadata);
@@ -74,7 +74,7 @@ public function create(string $resourceClass, string $property, array $options =
7474
continue;
7575
}
7676

77-
$annotation = $this->reader->getMethodAnnotation($reflectionMethod, Property::class);
77+
$annotation = $this->reader->getMethodAnnotation($reflectionMethod, ApiProperty::class);
7878
if (null !== $annotation) {
7979
return $this->createMetadata($annotation, $parentPropertyMetadata);
8080
}
@@ -103,7 +103,7 @@ private function handleNotFound(PropertyMetadata $parentPropertyMetadata = null,
103103
throw new PropertyNotFoundException(sprintf('Property "%s" of class "%s" not found.', $property, $resourceClass));
104104
}
105105

106-
private function createMetadata(Property $annotation, PropertyMetadata $parentPropertyMetadata = null) : PropertyMetadata
106+
private function createMetadata(ApiProperty $annotation, PropertyMetadata $parentPropertyMetadata = null) : PropertyMetadata
107107
{
108108
if (!$parentPropertyMetadata) {
109109
return new PropertyMetadata(

src/Metadata/Property/Factory/AnnotationPropertyNameCollectionFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace ApiPlatform\Core\Metadata\Property\Factory;
1313

14-
use ApiPlatform\Core\Annotation\Property;
14+
use ApiPlatform\Core\Annotation\ApiProperty;
1515
use ApiPlatform\Core\Exception\ResourceClassNotFoundException;
1616
use ApiPlatform\Core\Metadata\Property\PropertyNameCollection;
1717
use ApiPlatform\Core\Util\Reflection;
@@ -62,7 +62,7 @@ public function create(string $resourceClass, array $options = []) : PropertyNam
6262

6363
// Properties
6464
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
65-
if ($this->reader->getPropertyAnnotation($reflectionProperty, Property::class)) {
65+
if ($this->reader->getPropertyAnnotation($reflectionProperty, ApiProperty::class)) {
6666
$propertyNames[$reflectionProperty->name] = true;
6767
}
6868
}
@@ -71,7 +71,7 @@ public function create(string $resourceClass, array $options = []) : PropertyNam
7171
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
7272
$propertyName = $this->reflection->getProperty($reflectionMethod->name);
7373

74-
if ($propertyName && $this->reader->getMethodAnnotation($reflectionMethod, Property::class)) {
74+
if ($propertyName && $this->reader->getMethodAnnotation($reflectionMethod, ApiProperty::class)) {
7575
$propertyNames[$propertyName] = true;
7676
}
7777
}

tests/Annotation/PropertyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace ApiPlatform\Core\Tests\Annotation;
1313

14-
use ApiPlatform\Core\Annotation\Property;
14+
use ApiPlatform\Core\Annotation\ApiProperty;
1515

1616
/**
1717
* @author Kévin Dunglas <[email protected]>
@@ -20,7 +20,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase
2020
{
2121
public function testAssignation()
2222
{
23-
$property = new Property();
23+
$property = new ApiProperty();
2424
$property->description = 'description';
2525
$property->readable = true;
2626
$property->writable = true;

tests/Fixtures/TestBundle/Entity/AbstractDummy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity;
1313

14+
use ApiPlatform\Core\Annotation\ApiProperty;
1415
use ApiPlatform\Core\Annotation\ApiResource;
1516
use ApiPlatform\Core\Annotation\Iri;
16-
use ApiPlatform\Core\Annotation\Property;
1717
use Doctrine\ORM\Mapping as ORM;
1818
use Symfony\Component\Validator\Constraints as Assert;
1919

@@ -44,7 +44,7 @@ abstract class AbstractDummy
4444
*
4545
* @ORM\Column
4646
* @Assert\NotBlank
47-
* @Property(iri="http://schema.org/name")
47+
* @ApiProperty(iri="http://schema.org/name")
4848
*/
4949
private $name;
5050

tests/Fixtures/TestBundle/Entity/CustomNormalizedDummy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity;
1313

14+
use ApiPlatform\Core\Annotation\ApiProperty;
1415
use ApiPlatform\Core\Annotation\ApiResource;
15-
use ApiPlatform\Core\Annotation\Property;
1616
use Doctrine\ORM\Mapping as ORM;
1717
use Symfony\Component\Serializer\Annotation\Groups;
1818
use Symfony\Component\Validator\Constraints as Assert;
@@ -44,7 +44,7 @@ class CustomNormalizedDummy
4444
*
4545
* @ORM\Column
4646
* @Assert\NotBlank
47-
* @Property(iri="http://schema.org/name")
47+
* @ApiProperty(iri="http://schema.org/name")
4848
* @Groups({"input", "output"})
4949
*/
5050
private $name;
@@ -53,7 +53,7 @@ class CustomNormalizedDummy
5353
* @var string The dummy name alias.
5454
*
5555
* @ORM\Column(nullable=true)
56-
* @Property(iri="https://schema.org/alternateName")
56+
* @ApiProperty(iri="https://schema.org/alternateName")
5757
* @Groups({"input", "output"})
5858
*/
5959
private $alias;

tests/Fixtures/TestBundle/Entity/Dummy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity;
1313

14+
use ApiPlatform\Core\Annotation\ApiProperty;
1415
use ApiPlatform\Core\Annotation\ApiResource;
15-
use ApiPlatform\Core\Annotation\Property;
1616
use Doctrine\Common\Collections\ArrayCollection;
1717
use Doctrine\ORM\Mapping as ORM;
1818
use Symfony\Component\Validator\Constraints as Assert;
@@ -41,15 +41,15 @@ class Dummy
4141
*
4242
* @ORM\Column
4343
* @Assert\NotBlank
44-
* @Property(iri="http://schema.org/name")
44+
* @ApiProperty(iri="http://schema.org/name")
4545
*/
4646
private $name;
4747

4848
/**
4949
* @var string The dummy name alias.
5050
*
5151
* @ORM\Column(nullable=true)
52-
* @Property(iri="https://schema.org/alternateName")
52+
* @ApiProperty(iri="https://schema.org/alternateName")
5353
*/
5454
private $alias;
5555

@@ -62,7 +62,7 @@ class Dummy
6262
* @var string A short description of the item.
6363
*
6464
* @ORM\Column(nullable=true)
65-
* @Property(iri="https://schema.org/description")
65+
* @ApiProperty(iri="https://schema.org/description")
6666
*/
6767
public $description;
6868

0 commit comments

Comments
 (0)