Reputation: 13
I'm using api platform with symfony 4. Trying to use a DTO for output on a class and following the docs (https://api-platform.com/docs/core/dto/).
My class looks something like this:
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use App\DTO\ElementDTO;
/**
* Elements
* @ORM\Table(name="elements")
* @ORM\Entity
* @ApiResource(
* inputClass=false,
* outputClass=ElementDTO::class
* )
*/
class Elements
{
}
However, I'm getting an error that looks like this:
Unknown property "inputClass" on annotation "ApiPlatform\Core\Annotation\ApiResource".
I searched the source code for api platform and could find no reference to inputClass or outputClass. Is the method in the docs deprecated or not yet implemented?
Upvotes: 1
Views: 779
Reputation: 3432
It seems that inputClass
and outputClass
are both in v2.4.0-beta1 only, and I think you use 2.3.6 since this is the latest stable release AFAIK.
See this commit : https://github.com/api-platform/core/commit/cb5421abdb19392ac225909f63cf8677583cedd3
Try to use the beta version (or dev-master
) in your code and see if it works
Upvotes: 1