Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Closed
Labels
Description
ATM,the documentation is a bit old and uncomplete. For exemple the doc tells to create the definition and then to tag it. So OLD 😂
For exemple, we could exemple how to enhance normalized data:
class TopicNormalizerimplements NormalizerInterface{private$router;private$normaliser;publicfunction__construct(UrlGeneratorInterface$router,ObjectNormalizer$normaliser) {$this->router =$router;$this->normaliser =$normaliser; }publicfunctionnormalize($topic,$format =null,array$context =array()) {$data =$this->normaliser->normalize($topic,'json',$context);$data['href']['self'] =$this ->router ->generate('topic_show', ['id' =>$topic->getId()], UrlGeneratorInterface::ABSOLUTE_URL ) ;return$data; }publicfunctionsupportsNormalization($data,$format =null) {return$datainstanceof Topic; }}