Answer the question
In order to leave comments, you need to log in
How to select records from tables in YII2?
Help plz! Such business that at selection from the table, the class does not write down values in properties.
object(app\models\Menu)#73 (10) { ["menuid"]=> NULL ["menuname"]=> NULL ["_attributes":"yii\db\BaseActiveRecord":private]=> array(2 ) { ["MenuID"]=> int(1) ["MenuName"]=> string(23) "Children's menu" } ["_oldAttributes":"yii\db\BaseActiveRecord":private]=> array(2) { ["MenuID"]=> int(1) ["MenuName"]=> string(23) "Kids menu" } ["_related":"yii\db\BaseActiveRecord":private]=> array(0) { } ["_errors":"yii\base\Model":private]=> NULL ["_validators":"yii\base\Model":private]=> NULL ["_scenario":"
{
public $menuid;
public $menuname;
public static function tableName()
{
return 'Menu';
}
}
$items = Menu::find()->one();
var_dump($items);
Tell me what am I doing wrong?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question