65 lines
1.2 KiB
PHP
Raw Normal View History

2022-09-25 21:32:09 +02:00
<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @author Guilhem N. <egetick@gmail.com>
*/
#[
ApiResource(
2022-09-25 21:33:08 +02:00
shortName: 'Dummy',
2022-09-25 21:32:09 +02:00
operations: [
2022-09-25 21:33:08 +02:00
new Get(name: 'get'),
new Get(name: 'custom2', uriTemplate: '/foo'),
new Post(name: 'custom', uriTemplate: '/foo'),
2022-09-25 21:32:09 +02:00
new GetCollection(),
],
)
]
class Dummy81
{
/**
* @var int
*/
private $id;
/**
* @var string
*
* @Assert\NotBlank
*/
2022-09-25 21:33:08 +02:00
#[ApiProperty(iris: ['http://schema.org/name'])]
2022-09-25 21:32:09 +02:00
private $name;
public function getId(): int
{
return $this->id;
}
public function setName(string $name)
{
$this->name = $name;
}
public function getName(): string
{
return $this->name;
}
}