original_string: public function beforeSave(Event $event, Entity $plugin, ArrayObject $options = null)
      {
          if ($plugin->isNew()) {
              $max = $this->find()
                  ->order(['ordering' => 'DESC'])
                  ->limit(1)
                  ->first();
              $plugin->set('ordering', $max->ordering + 1);
          }
      }
code: public function beforeSave(Event $event, Entity $plugin, ArrayObject $options = null)
      {
          if ($plugin->isNew()) {
              $max = $this->find()
                  ->order(['ordering' => 'DESC'])
                  ->limit(1)
                  ->first();
              $plugin->set('ordering', $max->ordering + 1);
          }
      }
code_tokens: public function beforeSave ( Event $ event , Entity $ plugin , ArrayObject $ options = null ) { if ( $ plugin -> isNew ( ) ) { $ max = $ this -> find ( ) -> order ( [ 'ordering' => 'DESC' ] ) -> limit ( 1 ) -> first ( ) ; $ plugin -> set ( 'ordering' , $ max -> ordering + 1 ) ; } }
docstring: Set plugin's load ordering to LAST if it's a new plugin being installed.
  
  @param \Cake\Event\Event $event The event that was triggered
  @param \Cake\ORM\Entity $plugin The Plugin entity being saved
  @param \ArrayObject $options The options passed to the save method
  @return void
docstring_tokens: Set plugin s load ordering to LAST if it s a new plugin being installed .