The module needs some updates to be compatible with D10.

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Issue summary: View changes
damienmckenna’s picture

From drupal-check:


 ------ --------------------------------------------------------------------- 
  Line   commerce_product_restriction.module                                  
 ------ --------------------------------------------------------------------- 
  26     Variable $selected_variation_id in empty() always exists and is not  
         falsy.                                                               
  52     Call to an undefined method                                          
         Drupal\Core\Entity\EntityInterface::getItems().                      
  120    Call to an undefined method                                          
         Drupal\commerce_product_restriction\AvailabilityChecker::check().    
  126    Call to an undefined method                                          
         Drupal\commerce_product_restriction\AvailabilityChecker::check().    
 ------ --------------------------------------------------------------------- 

 ------ ----------------------------------------------------------- 
  Line   src/AvailabilityChecker.php                                
 ------ ----------------------------------------------------------- 
  54     Call to an undefined method                                
         Drupal\commerce\PurchasableEntityInterface::getProduct().  
 ------ ----------------------------------------------------------- 

 ------ ---------------------------------------------- 
  Line   src/Element/Restrictions.php                  
 ------ ---------------------------------------------- 
  122    Call to an undefined method                   
         Drupal\Core\Form\FormInterface::getEntity().  
 ------ ---------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/DatesRestriction.php            
 ------ ----------------------------------------------------------------------- 
  154    Method                                                                 
         Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestrictio  
         n\DatesRestriction::accessErrorMessage() has invalid return type       
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/PasswordRestriction.php         
 ------ ----------------------------------------------------------------------- 
  72     Call to an undefined method                                            
         Drupal\Core\Form\FormInterface::getEntity().                           
  116    Call to an undefined method                                            
         Drupal\Core\Form\FormInterface::getEntity().                           
  140    Call to an undefined method                                            
         Drupal\Core\Entity\EntityInterface::getPurchasedEntity().              
  159    Method                                                                 
         Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestrictio  
         n\PasswordRestriction::accessErrorMessage() has invalid return type    
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/PurchaseQuantityRestriction.ph  
         p                                                                      
 ------ ----------------------------------------------------------------------- 
  74     Call to an undefined method                                            
         Drupal\Core\Entity\EntityInterface::getProduct().                      
  127    Method                                                                 
         Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestrictio  
         n\PurchaseQuantityRestriction::accessErrorMessage() has invalid        
         return type                                                            
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/UserRestriction.php             
 ------ ----------------------------------------------------------------------- 
  83     Method                                                                 
         Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestrictio  
         n\UserRestriction::accessErrorMessage() has invalid return type        
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/UserRoleRestriction.php         
 ------ ----------------------------------------------------------------------- 
  74     Method                                                                 
         Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestrictio  
         n\UserRoleRestriction::accessErrorMessage() has invalid return type    
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/ProductRestrictionPluginBase.php                            
 ------ ----------------------------------------------------------------------- 
  69     Method                                                                 
         Drupal\commerce_product_restriction\Plugin\ProductRestrictionPluginBa  
         se::accessErrorMessage() has invalid return type                       
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/ProductRestrictionPluginInterface.php                       
 ------ ----------------------------------------------------------------------- 
  19     Method                                                                 
         Drupal\commerce_product_restriction\Plugin\ProductRestrictionPluginIn  
         terface::accessErrorMessage() has invalid return type                  
         Drupal\commerce_product_restriction\Plugin\TranslatableMarkup.         
 ------ ----------------------------------------------------------------------- 

 [ERROR] Found 17 errors                                                        
damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new4.33 KB

This resolves many of the issues, now it's down to:

 ------ ------------------------------------------------------------------- 
  Line   commerce_product_restriction.module                                
 ------ ------------------------------------------------------------------- 
  121    Call to an undefined method                                        
         Drupal\commerce_product_restriction\AvailabilityChecker::check().  
  127    Call to an undefined method                                        
         Drupal\commerce_product_restriction\AvailabilityChecker::check().  
 ------ ------------------------------------------------------------------- 

 ------ ----------------------------------------------------------- 
  Line   src/AvailabilityChecker.php                                
 ------ ----------------------------------------------------------- 
  54     Call to an undefined method                                
         Drupal\commerce\PurchasableEntityInterface::getProduct().  
 ------ ----------------------------------------------------------- 

 ------ ---------------------------------------------- 
  Line   src/Element/Restrictions.php                  
 ------ ---------------------------------------------- 
  122    Call to an undefined method                   
         Drupal\Core\Form\FormInterface::getEntity().  
 ------ ---------------------------------------------- 

 ------ ---------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/PasswordRestriction.php  
 ------ ---------------------------------------------------------------- 
  72     Call to an undefined method                                     
         Drupal\Core\Form\FormInterface::getEntity().                    
  117    Call to an undefined method                                     
         Drupal\Core\Form\FormInterface::getEntity().                    
  120    Call to an undefined method                                     
         Drupal\commerce\PurchasableEntityInterface::getProduct().       
 ------ ---------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Plugin/Commerce/ProductRestriction/PurchaseQuantityRestriction.ph  
         p                                                                      
 ------ ----------------------------------------------------------------------- 
  74     Call to an undefined method                                            
         Drupal\Core\Entity\EntityInterface::getProduct().                      
 ------ ----------------------------------------------------------------------- 
damienmckenna’s picture

Note - most of the changes reported by drupal-check are code cleanliness issues, rather than D10 bugs, the only actual compatibility issues seem to be the info file.

mitsuko’s picture

Hi maxwellkeeble,

First, thanks to share this module. It's very useful !

I wanted to know if you were planning an update to the development branch for Drupal 10 in the more or less near future ?

Thanks a lot for your response

maxwellkeeble’s picture

Hi, I've incorporated the changes from the patch and some other minor bug changes and done a D10 release. Let me know if any issues.

maxwellkeeble’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.