Код: Выделить всё
public function getRequirement()
{
$guid = new Expression('RIGHT (CONVERT(CHAR(34), _IDRRef, 1), 32) ');
$date = new Expression('DATEDIFF(s, \'1970-01-01 00:00:00\', CONVERT(VARCHAR, (DATEADD (yyyy, -2000, _Date_Time)), 20))');
$model = Requirement::find()
->select([
'_IDRRef' => $guid,
'_Date_Time' => $date,
'_Number',
'_Fld10440'
])
->joinWith('document255VT4740')
->andWhere(['_Fld4701RRef' => new Expression('CONVERT(binary(16), ' . $this->status . ' ,1)')])
->andWhere(['_Posted' => new Expression('CONVERT(binary(1), ' . $this->posted . ' ,1)') ])
->all();
return $model;
}
public function getDocument255VT4740()
{
return $this->hasMany(Document255VT4740::className(), ['_Document255_IDRRef' => '_IDRRef']);
}
делал document255VT4740._Fld10440
пишет
"[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Не удалось привязать составной идентификатор \"document255VT4740._Fld10440\"."