xp-forge / frontend

Web frontends
1 stars 1 forks source link

Support unmarshalling handler parameters #47

Closed thekid closed 8 months ago

thekid commented 8 months ago

Example:

use com\example\ObjectId;
use web\frontend\{Handler, Get};

#[Handler('/posts')]
class Posts {

  #[Get('/{id}')]
  public function get(ObjectId $id) {
    return ['id' => $id->string()];
  }
}

This would previously raise the following error: Argument 1 ($id) must be of type com\example\ObjectId, string given. This pull request makes this library behave consistently with https://github.com/xp-forge/rest-api

thekid commented 8 months ago

Released in https://github.com/xp-forge/frontend/releases/tag/v6.0.0 🎄

thekid commented 8 months ago

Compatibility release https://github.com/xp-forge/handlebars-templates/releases/tag/v3.2.0 🎄