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
Currently, the row count is "dumb". Assuming you're mocking an insert or update here, it does not know how to translate that into a sane affected row count. I'm not entirely sure it could or should, as there'd really be now way to guess what a database engine would answer back. If you want a value returned there, you have to set it using a setter on the result object:
To clarify, this is a select statement. I'd agree for an insert or update statement, you'd likely need to keep it "dumb". For select statements though, it'd be nice if it just returned the count of the rows in the mock results. Currently to make this happen it's fairly verbose:
For a fix, I'd think it'd need to be something along the lines of "if affectedRowCount has been manually set, return that, else return count($rows)", to avoid breaking existing usages. The part I could use some guidance on is on is how to make that work with parameterized queries, as I'm just getting started with this library and I'm not 100% clear on how they work.
When creating a mocked select result from an array, the rowCount stays at 0. e.g.
Assuming I'm not just doing something wrong, I'd be happy to submit a PR for this, though it'd be helpful to be pointed in the right direction 😃
The text was updated successfully, but these errors were encountered: