A
A
atis //2016-09-23 10:27:36
Yii
atis //, 2016-09-23 10:27:36

How to add an attribute containing invalid characters to a model in Yii2?

Hello.
It is necessary to add and validate a field containing a minus sign -> '-'.
How can this be checked?
UPD: you need to fill in the form with data and validate it. If the attribute is not added, then an exception is thrown - [yii\base\UnknownPropertyException]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-09-23
Protko @Fesor

$foo->{'foo-bar'} = 'something';
but it's better not to.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question