CodeDredd / pinia-orm

The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.
https://pinia-orm.codedredd.de/
MIT License
452 stars 38 forks source link

userRepo.get is not a function #1776

Closed khamaileon closed 6 months ago

khamaileon commented 9 months ago

Environment

No response

Reproduction

https://pinia-orm-play.codedredd.de/#N4IgDghgxg1hDmBTAziAXAbVAOwgW0XRADcBXRAWgBNE8BLEAGhGQHtSAnKQtEU7MDHhMQNZFA50wAFzqtsRAGrkABABFadFQAoAFhAA2AMxV1sKgGIdE2KLoCUp5CogqaxRAdZgz8FaVkDOmkATxcDLwB3ZxD2FWlWFUjJaUQVAFVsOg8OZEMVZTSAGToAIw4ISRQVI1YOAtUAJhUAMhUAZhFOAyJdaWkwZDQAemH+QXgAOihWPGGyShp6YaDS4bMaAA9JvAArVABfRhx8HhAAAQXSZERh5H1rKhE2Tm4icaERMQkpWXkiADKD0QVAaiHSN38gWCdBQky6HB6vD6AyGow+Uxmc0u5Gut3ulRB5wArJMAAyTACM62wW0mKDwk32ICOJwIRBxiDxwxm1me7C4ZwxXxQPxkcgUvAAwqwIogoH9zKwTCgbthZPlCioZXgwKxkDD5BlobIUAikSAUYMRmMBEJprNhpzubzECTyVSaXSGUzDscQLh2bxOcN3AlZcgKBAfPzXkK7cJmN9JOL-rwAJLqxAVBVJYK6eK6NJasOsCM1DizQtpSBIc29frW9EJh3YhahxDEcMGSPRujnABsk0antWwwZXsQ22ZrIDpyIPiyEFjgveCZF4hTiqIAAUzHRl8xug3UTaMa3houD+cR5TJgPQ3RkNJL-uIPTkHgKOVWNFs76WX9QMznOK8IAoOo5mwSDDDoAAvDgVzeXhhSTUUtwlXc3xUAB5AAlABZFRoI4PBYIQ+tkUbNFbQmC9QLfCDSOGEiyKCBDzjvAB2clH2fSdtj2P02TOXBoLoKgWPkCgbigThCGYF5VxQ9c0M3X5MN4AA5CBxKeI9ERPJtaPtLEWN01gJPOAAWD0ySk7AZPleSBIA2dgIXRjIKQ+MJg3MVt14Pcl1wwjK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vQUMFQxUOA+3agcP59SVCaF4ZkmgLOACi9BpDIG0BgKRKDTOsCkVlGXKSdfAvQaC8FDzIUdXl9obXJmTeAKkUI8FUu0VDIAkVEANV8UNV4OT34RApyKJ8YgIwEAObKO55M3nGAbVc7+xJXnlIhd-eArzqRAApVguhsAAGlHeXZjS-eNibk0GDT1aGidBJhgAqLGyo0woDDBBmSAA-PanqxIuL57+3lHtfbEBp8z9n7v2bt397T3n5P2bL3R+e5b-zSmCpp4BKQI2HAR+YaOHPuPC-ghL5cTKWUG-s1b7+zlG1p+2479tQnlQjQp+2tTy49PulEBqGP7nQvcaE1JsROXyKowVeNeX+9eUAjezebeiaPU1kxIH+V03az44+z+r+cBKgY+pwaeagrAiAqBM+KgMeSO8+mmi+A+LiWorqT4bgEcqBc0l+mG1+omJBaeaiBUxCaQWkpAAsHQNB28D+2aDBmGTBLixUVAoIz4pARgRgPBdBbc5+qqBwr0kM2AqKRwIAeS7uuKtUBKRAfuMglOQefCKgBEiCngmi2iLiDOeAXiBhIKWi0ibigmwStSlsmwBhSuYeBgvCjqJiZq3MNgVAzgxhqMRBz49Uhmcu6owQYQmSUiQ8TOc0oRsgUANQsIBgARCyRBc01g0gnA5gAhc0t+x2T4kwpAEkCyfBucT+RRyAfSUsvgNuUi9gFRc0IBxev+ZehYxRK29RUijRzRKRfeGBnRNR3RccDRTRl26BBAvO1RtRsc8A4x-ReBsx+gyABEukiK7iQisR-c6YVAfRF+r0ChyhaK7iGhnueKdUPuIAuh0g+h9ia8QRphdOdhOilhTOge9i7h4ekmDipufhtIgRJh401+iR4Rm0URLSUil68RQaP8SRKRng6RjgAh2RuRmRuchRjKNRpRJyExf2QhsxoxCxvR+J2aGMexMx2J0a-QHA7SFcZJucxxtBLuO8BwQAA

Describe the bug

Doc says:

Note that the retrieved models are indeed the model instances. Not the plain object. For example, when you call useRepo(User).get(), you'll get a list of User model instances as a result.

userRepo.get() give me:

userRepo.get is not a function

I also notice that userRepo.orderBy("name").get() returns all users with related data, as if I had done all()

Additional context

No response

Logs

No response

mariusgnicula commented 8 months ago

For me using Nuxt 3 with Pinia ORM, I have the same issue, where .all() gives me an error that it doesn't exist, but your orderBy "solution" is working for me as well.

vesper8 commented 7 months ago

Have you tried userRepo.query().get()

CodeDredd commented 6 months ago

userRepo.query().get() === userRepo.all() === userRepo.where().with()....all()

get() is only for querie chains.

Maybe for v2 i remove all() and add get() to repo. But i don't know yet if that makes sense.