You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a field in my database (MySQL) called 'video-size'
When I try to get that field the SQL generated queries does
SELECT Tutoriels.video-size AS `Tutoriels__video-size` FROM tutoriels AS Tutoriels'
One solution would be to surround every fields (or only fields containing -) with '
SELECT Tutoriels.`video-size` AS `Tutoriels__video-size` FROM tutoriels AS Tutoriels
Another solution is to throw an error explaining that the database should not contain such a field since it will cause lots of trouble like "how to get that field from entity"
$entity->get('video-size') // Does this would work ?
$entity->video-size // Since this will never work
The text was updated successfully, but these errors were encountered:
Cake 3.0 will do as little as possible to quote your database names and column names. If you really need to use invalid SQL names you can use quoteIdentifiers as described in the docs, in that case $entity->get('video-size') would work fine, but as you figured out with the $entity->video-size, it makes much more sense to stick in the safe side of sql.
I have a field in my database (MySQL) called 'video-size'
When I try to get that field the SQL generated queries does
One solution would be to surround every fields (or only fields containing -) with '
Another solution is to throw an error explaining that the database should not contain such a field since it will cause lots of trouble like "how to get that field from entity"
The text was updated successfully, but these errors were encountered: