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
Describe the bug
With orator, I could write a query with Model Query ou Query Builder (DB.table) and the return is a object. With this, I could pass this return to only a function and the process is the same, independent of who call the function.
With masonite-orm, when I write a query with Model Query, I get a collection of objects, but, when I write a query with Query Builder, I get a list. With this, I need call different process, only to change the way of get the data.
To Reproduce
Steps to reproduce the behavior: IN ORATOR
To work, I need do:
ustest02 = users2[0]
print(ustest02['name'])
With this, I need a function to data from Model Query and another to data from Query Builder, however, the process is the same.
Expected behavior
What do you believe should be happening?
I think the return could (if possible) be the same type (object), with this, I could make only a process, independent of who call the function.
Screenshots or code snippets
Screenshots help a lot. If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
I'm not sure how we can accomplish this without any breaking changes. One way to do this if you realy want to use the query builder is to pass the model in the query builder like this:
builder=QueryBuilder(model=User)
This is how the model and query builder work together under the hood. The model just passes itself to the query builder
Another way to do this as well is instead of trying to always the query builder and the model as an attribute on an object, just get both as a dictionary.
Describe the bug
With orator, I could write a query with Model Query ou Query Builder (DB.table) and the return is a object. With this, I could pass this return to only a function and the process is the same, independent of who call the function.
With masonite-orm, when I write a query with Model Query, I get a collection of objects, but, when I write a query with Query Builder, I get a list. With this, I need call different process, only to change the way of get the data.
To Reproduce
Steps to reproduce the behavior:
IN ORATOR
IN MASONITE-ORM
** Not work **
To work, I need do:
ustest02 = users2[0]
print(ustest02['name'])
With this, I need a function to data from Model Query and another to data from Query Builder, however, the process is the same.
Expected behavior
What do you believe should be happening?
I think the return could (if possible) be the same type (object), with this, I could make only a process, independent of who call the function.
Screenshots or code snippets
Screenshots help a lot. If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
What database are you using?
Additional context
Thread on slack:
https://masoniteproject.slack.com/archives/CAKB7NARF/p1615647050007700
The text was updated successfully, but these errors were encountered: