Skip to content

Annotation for guarding routes #33

@nusje2000

Description

@nusje2000

For ease of use, an annotation can be added that handles feature assertions. This should work something like this:

use Nusje2000\FeatureToggleBundle\Annotation as FeatureToggle;
// imports ...

/**
 * @Route("/some-route", name="route_name") # The symfony route definition
 *
 * @FeatureToggle\AssertEnabled() # Guard method
 * @FeatureToggle\AssertEnabled(route="route_name") # With route specification
 * @FeatureToggle\AssertEnabled(redirect="redirect_route_name") # With redirect route name
 * @FeatureToggle\AssertEnabled(redirect="/some/path") # With redirect path
 *
 * @FeatureToggle\AssertDisabled() # Guard method
 * @FeatureToggle\AssertDisabled(route="route_name") # With route specification
 * @FeatureToggle\AssertDisabled(redirect="redirect_route_name") # With redirect
 * @FeatureToggle\AssertDisabled(redirect="/some/path") # With redirect path
 */
public function someControllerMethod(): Response
{
    // ... code ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions