verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

[v3] Getting an item using `listTypeHandle()` returns an error #139

Closed martyspain closed 2 months ago

martyspain commented 3 months ago

Describe the bug

The example in the migration guide says that the old query format for fetching an item by passing in some combination of an element ID, a list ID and a list type handle should be updated. However, it seems like the listTypeHandle() query param isn't supported in the v3 syntax.

I have a few queries that look like this in my codebase:

{% set item = craft.wishlist.item(elementId, listId, listTypeHandle) %}

According to the migration guide example, this should be updated to the following:

{% set item = craft.wishlist.items()
    .listId(listId)
    .listTypeHandle(listTypeHandle)
    .elementId(elementId)
    .one() %}

When I try and load the page, I get an error instead:

Calling unknown method: verbb\wishlist\elements\db\ItemQuery::listTypeHandle()

Steps to reproduce

  1. Try fetching a list item by its list type handle using the v3 Twig syntax: craft.wishlist.items().listTypeHandle(listTypeHandle).one()
  2. Observe a Twig runtime error

Craft CMS version

5.1.10

Plugin version

3.0.0

Multi-site?

No

Additional context

No response

engram-design commented 3 months ago

Looks like that param has just been omitted, sorry about that.

Fixed for the next release. To get this early, run composer require verbb/wishlist:"dev-craft-5 as 3.0.0".

martyspain commented 3 months ago

Brilliant, thanks for the very quick response!

engram-design commented 2 months ago

Fixed in 3.0.1