Skip to content

0.9.x

Compare
Choose a tag to compare
@neomerx neomerx released this 09 May 20:17
· 190 commits to master since this release

Some compatible improvements to the project. The main focus and the source for breaking changes were changing validation for inputs (forms and JSON API queries and data).

  • Limoncello\Flute\Contracts\Validation\FormRuleSetInterface renamed to Limoncello\Flute\Contracts\Validation\FormRulesInterface
  • Limoncello\Flute\Contracts\Validation\JsonApiRuleSetInterface renamed to Limoncello\Flute\Contracts\Validation\JsonApiDataRulesInterface
  • Controller class constants ON_CREATE_VALIDATION_RULES_SET_CLASS and ON_UPDATE_VALIDATION_RULES_SET_CLASS were renamed to ON_CREATE_DATA_VALIDATION_RULES_CLASS and ON_UPDATE_DATA_VALIDATION_RULES_CLASS.
  • Instead of Limoncello\Flute\Contracts\Validation\QueryRuleSetInterface interface Limoncello\Flute\Contracts\Validation\JsonApiQueryRulesInterface should be used. The new interface provides new methods for efficient validation for JSON API query parameters (filters, field sets, sorts, includes and paging). A simple start could be extend/inherit Limoncello\Flute\Validation\JsonApi\DefaultQueryValidationRules which forbids filters, field sets, sorts and includes but allows pagination.
  • Two new controller class constants were added ON_INDEX_QUERY_VALIDATION_RULES_CLASS and ON_READ_QUERY_VALIDATION_RULES_CLASS each of them should point to a class that implements JsonApiQueryRulesInterface. The rules would be used for query validation on index and read actions.

Controller methods configureOnXXXParser which were used for configuring validation of JSON API queries are deprecated. All the functionality (and more) could be done in rules that implement JsonApiQueryRulesInterface.

Controller method readRelationshipWithClosure was replaced with defaultReadRelationshipWithClosure. If you only need data from API taken via API method readRelationship($index, $modelRelationhsipName) use controller method readRelationship. If you need some custom behaviour then defaultReadRelationshipWithClosure (controller's readRelationship will be an example how to work with it).

Class \Limoncello\Flute\Http\BaseController was refactored and now look super simple and easy. All helper methods were moved to \Limoncello\Flute\Http\Traits\DefaultControllerMethodsTrait. If you are not happy with the default controller handlers or you do not want to inherit from BaseController you can very easily add your own handlers combined with methods from DefaultControllerMethodsTrait.

Route helpers \Limoncello\Flute\Http\Traits\FluteRoutesTrait::resource and \Limoncello\Flute\Http\Traits\FluteRoutesTrait::controller were renamed to \Limoncello\Flute\Http\Traits\FluteRoutesTrait::apiController and \Limoncello\Flute\Http\Traits\FluteRoutesTrait::webController.

Interface \Limoncello\Flute\Contracts\Http\ControllerInterface was split into \Limoncello\Flute\Contracts\Http\JsonApiControllerInterface and \Limoncello\Flute\Contracts\Http\WebControllerInterface as they have similar but slightely different methods.