Closed afeique closed 7 years ago
Fixed. Please check if it works now.
Verified fix. It works. Thanks so much for the fast turnaround!
@lynicidn ?
@samdark просмотрев тесты - можно предположить (если они не падают), что это ишью ошибочное
@samdark меня смущает вот это в его коде
public static function tableName()
{
return 'tickets.workflows';
}
точка говорит о базе данных, которую Pdo выбирает из конфига - тут не надо указывать бд
Тесты падали до фикса. В MySQL можно использовать таблицу из другой базы и синтаксис именно такой.
What steps will reproduce the problem?
Windows 7 32-bit
Uniform Server Zero XIII 13.3.2 https://sourceforge.net/projects/miniserver/files/Uniform%20Server%20ZeroXIII/13_3_2_ZeroXIII/13_3_2_ZeroXIII.exe/download
PHP 5.6.30 Module for Uniform Server https://sourceforge.net/projects/miniserver/files/Uniform%20Server%20ZeroXIII/ZeroXIIImodules/ZeroXIII_php_5_6_30_j.exe/download
MySQL 5.6.35 database with this table:
composer.json:
Create
workflow
model using gii.Create CRUD for
workflow
model using gii.Note that in the Yii configuration, the default MySQL host and database DSN is:
common/config/main-local.php
:However, the
workflows
table is located under a different database calledtickets
in localhost:frontend/models/Workflow.php
(generated by gii):Attempting to create a new workflow causes a MySQL PDO Exception owing to a bad alias where "0." gets prefixed to the table name as described below.
What is the expected result?
A new workflow row is added to the workflows table.
What do you get instead?
Additional info
Commenting out the following rule in the generated
Workflow
model (frontend/models/Workflow.php
)rules()
method fixes this issue:Alternatively, in
vendor/yiisoft/yii2/validators/UniqueValidator.php
online 288
:may be erroneous and perhaps what was intended is:
But I do not know for sure.