$_POST['Test']
, а в модель ты загружаешь просто $_POST
. Нужно так: $model->load(Yii::$app->request->bodyParams['Test'])
with('author')
public function getPartners(){
$sql = 'SELECT dam as partner_id FROM pedigrees WHERE (sire=:id and dam<>0) group by dam union SELECT sire as partner_id FROM pedigrees WHERE (dam=:id and sire<>0) group by sire order by (select name from pedigrees a where id=:partner_id)';
$partner = Pedigrees::findBySql($sql, [':id' => $id, 'partner_id' => $partner_id])->all();
return $partner;
}
Yii::$app->request->post()
Yii::$app->request->bodyParams
public function rules()
{
return [
['child_age', 'each', 'rule' => ['integer'], 'skipOnEmpty' => false],
['child_age', 'each', 'rule' => ['compare', 'compareValue' => 2, 'operator' => '>='], 'skipOnEmpty' => false]
];
}
private function log($success, $error = null)
{
if ($success) {
$this->stdout(date("Y-m-d H:i:s") . ': Success!', Console::FG_GREEN, Console::BOLD);
} else {
$this->stdout(date("Y-m-d H:i:s") . ': ' . $error, Console::FG_RED, Console::BOLD);
}
echo PHP_EOL;
}