* @copyright Copyright (c) Others as mentioned in code
11
* @link https://maslosoft.com/mangan/
12
*/
13
14
namespace Maslosoft\Mangan\Annotations;
15
16
use InvalidArgumentException;
17
use Maslosoft\Mangan\Decorators\Property\I18NDecorator;
18
use Maslosoft\Mangan\Meta\I18NMeta;
19
use Maslosoft\Mangan\Meta\ManganPropertyAnnotation;
20
21
/**
22
* This annotation indicates internationallized fields
23
* @template I18N
24
* @Target('property')
25
* @author Piotr
26
*/
27
class I18NAnnotation extends ManganPropertyAnnotation
28
{
29
30
public $value = true;
31
public $allowDefault = false;
32
public $allowAny = false;
33
34
7
public function init()
35
{
36
7
if ($this->allowDefault && $this->allowAny)
37
{
38
throw new InvalidArgumentException(sprintf('Arguments "allowDefault" and "allowAny" for element "%s" in class "%s" cannot be both set true', $this->name, $this->getMeta()->type()->name));