Fosrestbundle: ルーティングオプション「親」が機能しない

作成日 2011年07月24日  ·  3コメント  ·  ソース: FriendsOfSymfony/FOSRestBundle

symfonyルーティングは、検証を通じて「親」属性が設定されるのを防ぎ、例外がスローされます。

Bug

最も参考になるコメント

デフォルトのルーティング構成内でrestfulルートを読み込もうとしているようです。 parentおよびその他のrest固有のパラメーターを使用できるようにするにparent 、そのような構成をrestfulコレクションに移動する必要があります。

これは間違っています:

# app/config/routing.yml
users:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController

user_topics:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
  parent:   users

しかし、これは正しいです:

# app/config/routing.yml
users:
  type: rest
  resource: path/to/your/bundle/routing.yml
# path/to/your/bundle/routing.yml
users:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController

user_topics:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
  parent:   users

全てのコメント3件

ここで例を挙げていただけますか?

デフォルトのルーティング構成内でrestfulルートを読み込もうとしているようです。 parentおよびその他のrest固有のパラメーターを使用できるようにするにparent 、そのような構成をrestfulコレクションに移動する必要があります。

これは間違っています:

# app/config/routing.yml
users:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController

user_topics:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
  parent:   users

しかし、これは正しいです:

# app/config/routing.yml
users:
  type: rest
  resource: path/to/your/bundle/routing.yml
# path/to/your/bundle/routing.yml
users:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController

user_topics:
  type:     rest
  resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
  parent:   users

ルーター構成でタイプを定義することにより、タイプrestを使用してメインファイルをロードすることもできることに注意してください。

このページは役に立ちましたか?
0 / 5 - 0 評価