Problem/Motivation

8.x-1.x fails phpstan
https://git.drupalcode.org/project/scheduler/-/jobs/7914821#L50

Note: Using configuration file /builds/project/scheduler/web/modules/custom/scheduler/phpstan.neon.
 ------ ----------------------------------------------------------------- 
  Line   scheduler.module                                                 
 ------ ----------------------------------------------------------------- 
  433    Call to deprecated function node_is_page():                      
         in drupal:11.3.0 and is removed from drupal:13.0.0. There is no  
            replacement, check the view mode instead during rendering.    
 ------ ----------------------------------------------------------------------- 

  Line   scheduler_rules_integration/src/Plugin/RulesAction/RemovePublishingDa  
         te.php                                                                 
  Line   scheduler_rules_integration/src/Plugin/RulesAction/RemoveUnpublishing  
         Date.php                                                               
  Line   scheduler_rules_integration/src/Plugin/RulesAction/SetPublishingDate.  
         php                                                                    
  Line   scheduler_rules_integration/src/Plugin/RulesAction/SetUnpublishingDat  
         e.php                                                                  
  Line   src/SchedulerManager.php                                    
 ------ ----------------------------------------------------------------------- 
  47     Call to deprecated function node_get_type_label():                     
         in drupal:11.3.0 and is removed from drupal:13.0.0. Use                
         $node->getBundleEntity()->label() instead.                             
 ------ ----------------------------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   src/SchedulerManager.php                                    
 ------ ------------------------------------------------------------ 
  670    Call to deprecated method revisionIds() of class
         Drupal\node\NodeStorage:                                    
         in drupal:11.3.0 and is removed from drupal:13.0.0. Use an entity query instead.                                     
 ------ ------------------------------------------------------------ 
 [ERROR] Found 8 errors                     

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 rules actions on core 10.2.png553.58 KBjonathan1055

Issue fork scheduler-3566803

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new553.58 KB

1. Previously node_is_page($node)=1. This can be replaced with $view_mode=full

2. The change record for node_get_type_label() is https://www.drupal.org/node/3533301
It says

If on 11.3 or above use $node->getBundleEntity()->label() instead.
If on 11.2 or below use $node->get('type')->entity->label() instead.

Running rulesaction tests on 11.2 confirms this, and we get

Error: Call to undefined method Drupal\node\Entity\Node::getBundleEntity() in Drupal\scheduler_rules_integration\Plugin\RulesAction\SetPublishingDate->doExecute()

See https://git.drupalcode.org/project/scheduler/-/jobs/7944137 and the attached.
It can be resolved using method_exists() and is_callable()

3. revisionIds() can be replaced with an entity query, and we can also use latestRevision() for efficiency. See https://www.drupal.org/node/2918184

jonathan1055’s picture

Status: Needs review » Fixed

Done.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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