Skip to content

Instantly share code, notes, and snippets.

@alezhu
Created October 7, 2016 06:44
Show Gist options
  • Save alezhu/4c73ba2aaa65c81bb1e61555effe842b to your computer and use it in GitHub Desktop.
Save alezhu/4c73ba2aaa65c81bb1e61555effe842b to your computer and use it in GitHub Desktop.
Simple Doctrine Annotation
use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\Annotation\Target;
/**
* Class Action
* @package App\Core
* @Annotation()
* @Target("METHOD")
*/
class CheckAction
{
public $value;
/**
* Action constructor.
* @param $value
*/
public function __construct($value)
{
if (is_array($value)) {
if (isset($value['value'])) {
$this->value = $value['value'];
} else if (isset($value[0])) {
$this->value = $value[0];
} else {
$this->value = $value;
}
} else {
$this->value = $value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment