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
{{ message }}
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
How to get a raw result(no Hanami::Entity) from a query. #477
but get an array of Hanami::Entities without "months", because it is not defined at entity-schema.
I think this worked in previous hanami-versions, but I'm not sure.
Just for info: To workaround the issue, I ended with a hack like this.
It's one of those cases where the POLS bites back at you. We make sure that everything that a repository returns is turned into an Entity. But entities have schemas and aren't really all that a repository can return.
What I can offer you, so you can get rid of the fetch call, is calling #map over the relation you get on your example.
@wuarmin it's a good idea - specially in case somebody needs only skinny API. I tried to find it somewhere in the docs, but without success, so a guide extension is a great idea.
changed the title [-]Hot to get a raw result(no Hanami::Entity) from a query.[/-][+]How to get a raw result(no Hanami::Entity) from a query.[/+]on May 14, 2018
Activity
mereghost commentedon Apr 17, 2018
It's one of those cases where the POLS bites back at you. We make sure that everything that a repository returns is turned into an Entity. But entities have schemas and aren't really all that a repository can return.
What I can offer you, so you can get rid of the fetch call, is calling
#mapover the relation you get on your example.That will skip the mapper and should return you an array of hashes.
mereghost commentedon Apr 17, 2018
BTW sorry for taking so long to get back at you, @wuarmin =(
wuarmin commentedon Apr 17, 2018
@mereghost thank you for your investigation! I like your suggestion. (What do you think about mentioning this at the guides for other users?)
apohllo commentedon May 14, 2018
@wuarmin it's a good idea - specially in case somebody needs only skinny API. I tried to find it somewhere in the docs, but without success, so a guide extension is a great idea.
[-]Hot to get a raw result(no Hanami::Entity) from a query.[/-][+]How to get a raw result(no Hanami::Entity) from a query.[/+]