Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Latest commit

 

History

History
47 lines (35 loc) · 885 Bytes

annotation.md

File metadata and controls

47 lines (35 loc) · 885 Bytes

Annotation

You can use annotations for checking the feature state in controllers. Just active this in your config:

# config.yml

flagception:
    features:      
        feature_123:
            default: true
        
    # Use annotation? (optional)
    annotation:
    
        # Enable controller annotation (default: false)
        enable: true

We recommend to use the route attribute solution, because using annotations has performance issues. A NotFoundHttpException will be thrown if you request an action or class with inactive feature flag.

# FooController.php

use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;

/**
 * @Feature("feature_123")
 */
class FooController
{

    /**
     * @Feature("feature_789")
     */
    public function barAction()
    {
    }

    public function fooAction()
    {
    }
}