Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/external-vocabularies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ApiPlatformBundle provides annotations usable on PHP classes and properties for

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\ApiProperty;
/**
* ...
* @see http://schema.org/Product Documentation on Schema.org
Expand All @@ -24,7 +24,7 @@ class Product

/**
* ...
* @Property(iri="http://schema.org/name")
* @ApiProperty(iri="http://schema.org/name")
*/
public $name;
}
Expand Down
30 changes: 15 additions & 15 deletions core/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ services:

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -50,7 +50,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @see http://schema.org/Offer Documentation on Schema.org
*
* @ORM\Entity
* @Resource(attributes={"filters"={"offer.search"}},iri="http://schema.org/Offer")
* @ApiResource(attributes={"filters"={"offer.search"}},iri="http://schema.org/Offer")
*/
class Offer
{
Expand Down Expand Up @@ -114,8 +114,8 @@ services:

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -125,7 +125,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @see http://schema.org/Offer Documentation on Schema.org
*
* @ORM\Entity
* @Resource(attributes={"filters"={"offer.search","offer.date"}},iri="http://schema.org/Offer")
* @ApiResource(attributes={"filters"={"offer.search","offer.date"}},iri="http://schema.org/Offer")
*/
class Offer
{
Expand Down Expand Up @@ -188,8 +188,8 @@ services:

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -199,7 +199,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @see http://schema.org/Offer Documentation on Schema.org
*
* @ORM\Entity
* @Resource(attributes={"filters"={"offer.search","offer.date","offer.order"}},iri="http://schema.org/Offer")
* @ApiResource(attributes={"filters"={"offer.search","offer.date","offer.order"}},iri="http://schema.org/Offer")
*/
class Offer
{
Expand Down Expand Up @@ -253,8 +253,8 @@ services:

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -264,7 +264,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @see http://schema.org/Offer Documentation on Schema.org
*
* @ORM\Entity
* @Resource(attributes={"filters"={"offer.search","offer.date","offer.boolean"}},iri="http://schema.org/Offer")
* @ApiResource(attributes={"filters"={"offer.search","offer.date","offer.boolean"}},iri="http://schema.org/Offer")
*/
class Offer
{
Expand Down Expand Up @@ -303,8 +303,8 @@ services:

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Property;
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -314,7 +314,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @see http://schema.org/Offer Documentation on Schema.org
*
* @ORM\Entity
* @Resource(attributes={"filters"={"offer.search","offer.date","offer.boolean","offer.numeric"}},iri="http://schema.org/Offer")
* @ApiResource(attributes={"filters"={"offer.search","offer.date","offer.boolean","offer.numeric"}},iri="http://schema.org/Offer")
*/
class Offer
{
Expand Down
8 changes: 4 additions & 4 deletions core/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ A resource can be defined through Annotations, Yaml or XML. The following repres

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity
* @Resource
* @ApiResource
*/
class Product
{
Expand All @@ -221,13 +221,13 @@ class Product

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity
* @Resource
* @ApiResource
*/
class Offer
{
Expand Down
12 changes: 6 additions & 6 deletions core/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ If you want to use custom controller action, [refer to the dedicated documentati

```php
<?php
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
* @Resource(itemOperations={
* @ApiResource(itemOperations={
* "get"={"method"="GET"},
* "put"={"method"="PUT"},
* "custom_get"={
Expand Down Expand Up @@ -136,11 +136,11 @@ resources:

```php
<?php
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
* @Resource(collectionOperations={"get"={"method"="GET"}})
* @ApiResource(collectionOperations={"get"={"method"="GET"}})
* @ORM\Entity
*/
class Product
Expand Down Expand Up @@ -178,11 +178,11 @@ resources:

```php
<?php
use ApiPlatform\Core\Annotation\Resource;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
* @Resource(collectionOperations={"get"={"method"="GET"}}, itemOperations={})
* @ApiResource(collectionOperations={"get"={"method"="GET"}}, itemOperations={})
* @ORM\Entity
*/
class Product
Expand Down
6 changes: 3 additions & 3 deletions getting-started/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ We generated a set of Plain-Old-PHP entities representing our data model. As pro
including database columns with type guessing, relations with cardinality guessing and class inheritance (through the
`@AbstractSuperclass` annotation).
* [Symfony validation annotations](https://symfony.com/doc/current/book/validation.html#constraints)
* API Platform `@Resource` and `@Property` annotations
* API Platform `@ApiResource` and `@ApiProperty` annotations
* Full high-quality [PHPDoc](https://www.phpdoc.org) for classes, properties, constants and methods extracted from Schema.org

The data model is fully functional. You can hack it (modify entities, properties, indexes, validation rules...), or use it
Expand Down Expand Up @@ -244,7 +244,7 @@ do is to remove `api-platform/schema-generator` from your `composer.json` file.
We have a working data model backed by a database. But we also got a working hypermedia REST API thanks to **[API Platform Core](../core/index.md)**.

The core, like the schema generator, is already pre-installed and properly configured.
We just need to mark resources we want to expose with an `@Resource` annotation. Open any of the generated entities, and
We just need to mark resources we want to expose with an `@ApiResource` annotation. Open any of the generated entities, and
you'll see that the schema generator already added this annotation for us.

And our API is already finished! How would it be easier?
Expand Down Expand Up @@ -275,7 +275,7 @@ in this document.
If you want to expose any entity:

* Put it in the `Entity` directory of a bundle
* Mark it with the `@ApiPlatform\Core\Annotation\Resource` annotation
* Mark it with the `@ApiPlatform\Core\Annotation\ApiResource` annotation

It's as easy as it looks.

Expand Down