backdrop-contrib / commerce

GNU General Public License v2.0
3 stars 4 forks source link

Calling reset() on an object is deprecated in commerce_cart_add_to_cart_form_product_ids() #17

Closed herbdool closed 1 week ago

herbdool commented 1 week ago

When viewing a node that has a product reference field that references more than one products:

Deprecated function: reset(): Calling reset() on an object is deprecated in commerce_cart_add_to_cart_form_product_ids() (line 2926 of /app/httpdocs/modules/commerce/modules/cart/commerce_cart.module).

herbdool commented 1 week ago

I think we can just remove the reset(). I get just one entity loading regardless of whether there's one or more products. PR: https://github.com/backdrop-contrib/commerce/pull/18

elisseck commented 1 week ago

Agreed! I think this is one of those gotchas that slightly changed in Backdrop. D7 did not have an implicit reset in entity_load because they've sent everything to entity_load_multiple now.

https://api.drupal.org/api/drupal/includes%21common.inc/function/entity_load/7.x

https://docs.backdropcms.org/api/backdrop/core%21modules%21entity%21entity.module/function/entity_load/1