Closed zak-wojtek77 closed 3 years ago
Can you specify what exactly entities or which part of WebTools?
For every entity does not work.
Do you have SQL error message?
I have not any SQL error. I have upgrade devtools to v4.0.1 but still the same problem.
I click: Models -> Generate and next click button "Generate":
What fields and checkboxes do you select?
Exactly how is on the screen.
Exactly de same trouble, with:
I had the same problem. I solved removing the options from config's database array.
return new Config([
'database' => [
'adapter' => 'Mysql',
'host' => getenv('MYSQL_HOST') ?: '',
'username' => getenv('MYSQL_USER') ?: '',
'password' => getenv('MYSQL_PASSWORD') ?: '',
'dbname' => getenv('MYSQL_DATABASE') ?: '',
'charset' => 'utf8',
// 'options' => [
// PDO::ATTR_EMULATE_PREPARES => false,
// PDO::ATTR_STRINGIFY_FETCHES => false,
// ]
],
'application' => [
'modelsDir' => '/models/',
'controllersDir' => '/controllers/',
'migrationsDir' => '/migrations/',
'baseUri' => '/',
]
]);
After create the models, return with the options.
It's happening because before adapter instance, there are some lines creating a condition that removes all database config in $configArray
overriding just with options.
if (isset($configArray['options'])) {
$configArray = $configArray['options'];
}
/** @var AbstractPdo $db */
$db = new $adapterName($configArray);
It's a little weird, I tried to understand why, but I can't.
That's the file and line: https://github.com/phalcon/phalcon-devtools/blob/f96c3062969af1cdec7ba97606b99dba6062b47e/src/Builder/Component/Model.php#L142
if (isset($configArray['options'])) {
$configArray = $configArray['options'];
}
It was added in #1432 due to 'fix' PdoFactory behavior. Unnecessary and breaking addition. Fixed in #1486
Will be released in next version.
Expected and Actual Behavior
Generate entity from webtools does not work. After click button "Generate" nothing do. Also I don't see any errors on screen.