Skip to content

Commit 85797f6

Browse files
committed
feature #968 [make:entity] APIP: use new attribute if exists (nikophil)
This PR was merged into the 1.0-dev branch. Discussion ---------- [make:entity] APIP: use new attribute if exists Hi, here is an update to use new `ApiResource` attribute from api platofrm v3 when providing `--api-resource` flag in `make:entity` command. This cannot be tested yet since v3 is not released Commits ------- f2a778a APIP: use new attribute if exists
2 parents 5a33ed3 + f2a778a commit 85797f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Resources/skeleton/doctrine/Entity.tpl.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace <?= $namespace ?>;
44

5-
<?php if ($api_resource): ?>use ApiPlatform\Core\Annotation\ApiResource;
5+
<?php if ($api_resource && class_exists(\ApiPlatform\Metadata\ApiResource::class)): ?>use ApiPlatform\Metadata\ApiResource;
6+
<?php elseif ($api_resource): ?>use ApiPlatform\Core\Annotation\ApiResource;
67
<?php endif ?>
78
use <?= $repository_full_class_name ?>;
89
use Doctrine\ORM\Mapping as ORM;

0 commit comments

Comments
 (0)