What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi guys π we encountered the following problem: In the db (MariaDB) a boolean
Hi guys π
we encountered the following problem: In the db (MariaDB) a boolean is stored, represented as tiniInt -> 0 or 1. Whenever this value is queried using a select statement, e.g. in the SalesQuantityRepository this value is formatted and passed on as String.
After that whenever a comparison is done, e.g. $itemTransfer->getIsQuantitySplittable() === false;
it evaluates to false, because '0' is not equal to false.
Does anyone encountered similar behaviour and do you know how to fix it?
changing === to == is not a valid solution in my opinion as this does not solve the actual problem.
Comments
-
Using non strict comparison (==) is actually the correct kind of comparison for such cases where the types can be inconsistent (also 1 vs '1' etc).
Long term, of course, the underlying API should be cleaner in types and would enable full strict checking everyone.0 -
If you want to be able to trust the documented types, check why those are not type casted before going into the transfer. Then that would be the source of the issue and where things need to be adjusted.
0 -
All code I was referring to is located in the vendor namespace though π
0 -
Sure, but you can always make PRs to any vendor lib and push some useful changes with this.
0 -
Its a bit strange since it feels no one ever changed the is_splittable option to false^^because then he would experience the same issue^^ β¦ or may it just a mariadb related issue (saving bools as tinyint?)
0 -
Very much possible.
0 -
As soon as transfers are more strict this will become visible for sure π
0 -
It is the same behaviour in the 'availability gui' for zed, there the availability is always 'false' π
0 -
I recommend an escalation through the normal channels.
Speed up via PR (partial or full showcase/resolution) is of course highly recommended.0 -
AFAIK, this is a Propel-MariaDB related thing that all return fields are now considered literals/strings and not numeric/boolean values anymore. We encountered that already on some custom queries that queried IDs and processed them internally with strict method types which broke due to hand over of string instead of int.
0 -
A PR to the repo would be most welcome
Maybe we can fix this for the upcoming new beta release? More type safety is planned anyway.0 -
Just a brief questions though, how was this not caught when proposing the switch of Postgres to MariaDB? π€
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 77 Spryker News
- 931 Developer Corner
- 789 Spryker Development
- 90 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 33 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random