start
This commit is contained in:
1 parent
a27213b5d7
commit
86c05390a9
6 files changed
+553
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace dominion\amqp;
|
||||
|
||||
use Yii;
|
||||
use yii\base\DynamicModel;
|
||||
|
||||
class CustomDynamicModel extends DynamicModel
|
||||
{
|
||||
public function __get($name)
|
||||
{
|
||||
if (!$this->hasAttribute($name)) {
|
||||
$getter = 'get' . $name;
|
||||
if (method_exists($this, $getter)) {
|
||||
// read property, e.g. getName()
|
||||
return $this->$getter();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent::__get($name);
|
||||
}
|
||||
|
||||
public function arrayValidate($attribute, $params)
|
||||
{
|
||||
if (!is_array($this->$attribute)) {
|
||||
$this->addError($attribute, 'Неверный формат "'.$attribute.'"');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user