问题描述
我正在尝试使用 API 平台为我的 REST API 创建实体。 我正在学习本教程,我现在正在这一步:https://api-platform.com/docs/distribution/#plugging-the-persistence-system
我将我的实体更改为使用 Doctrine\ORM\ 并且 localhost/docs 因错误 502 停止工作,老实说我不知道为什么。 当我尝试打开 localhost/admin 时出现此错误:
Unhandled Runtime Error
Error: Cannot fetch API documentation:
Status: 502
Call Stack
eval
webpack-internal:///./node_modules/@api-platform/admin/lib/hydra/dataProvider.js (505:13)
这是我的实体代码:
<?PHP
// api/src/Entity/User.PHP
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
/**
* A user
*
* @ORM\Entity
*/
#[ApiResource]
class User
{
/**
* User ID
*
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* User name
*
* @ORM\Column
*/
public string $name;
public function getId(): ?int
{
return $this->id;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)