Angular クライアントで Symfony API を使用しています。現在、データベースにデータを追加するために、API に投稿しようとしています。通知を作成したいので、 NotificationService を実行しました。
createNotif(user: User, job: QuotationJob, type: string): Observable<Notification> {
return this.rg.all('notifications').customPOST({
type: type,
user: user['@id'],
job: job['@id'],
readed: "false",
});
}
次に、次のようにして、component.ts でこのメソッドを使用しようとします。
this.notificationService.createNotif(favoriteUser, job, notificationType).subscribe(value => {
console.log(value);
});
今のところ、私は POST を機能させようとしています。しかし、私はこのエラーが発生します:
{
"data": {
"data": {
"@context": "/api/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "The property path constructor needs a string or an instance of \"Symfony\\Component\\PropertyAccess\\PropertyPath\". Got: \"integer\"",
何が問題なのかわかりません。User[@id] と job[@id] は次のようになります: /api/users/2
.