original_string: public function cascadeDelete(EntityInterface $entity, array $options = [])
      {
          if (!$this->getDependent()) {
              return true;
          }
          $foreignKey = (array)$this->getForeignKey();
          $bindingKey = (array)$this->getBindingKey();
          $conditions = [];
  
          if (!empty($bindingKey)) {
              $conditions = array_combine($foreignKey, $entity->extract($bindingKey));
          }
  
          $table = $this->junction();
          $hasMany = $this->getSource()->getAssociation($table->getAlias());
          if ($this->_cascadeCallbacks) {
              foreach ($hasMany->find('all')->where($conditions)->all()->toList() as $related) {
                  $table->delete($related, $options);
              }
  
              return true;
          }
  
          $conditions = array_merge($conditions, $hasMany->getConditions());
  
          $table->deleteAll($conditions);
  
          return true;
      }
code: public function cascadeDelete(EntityInterface $entity, array $options = [])
      {
          if (!$this->getDependent()) {
              return true;
          }
          $foreignKey = (array)$this->getForeignKey();
          $bindingKey = (array)$this->getBindingKey();
          $conditions = [];
  
          if (!empty($bindingKey)) {
              $conditions = array_combine($foreignKey, $entity->extract($bindingKey));
          }
  
          $table = $this->junction();
          $hasMany = $this->getSource()->getAssociation($table->getAlias());
          if ($this->_cascadeCallbacks) {
              foreach ($hasMany->find('all')->where($conditions)->all()->toList() as $related) {
                  $table->delete($related, $options);
              }
  
              return true;
          }
  
          $conditions = array_merge($conditions, $hasMany->getConditions());
  
          $table->deleteAll($conditions);
  
          return true;
      }
code_tokens: public function cascadeDelete ( EntityInterface $ entity , array $ options = [ ] ) { if ( ! $ this -> getDependent ( ) ) { return true ; } $ foreignKey = ( array ) $ this -> getForeignKey ( ) ; $ bindingKey = ( array ) $ this -> getBindingKey ( ) ; $ conditions = [ ] ; if ( ! empty ( $ bindingKey ) ) { $ conditions = array_combine ( $ foreignKey , $ entity -> extract ( $ bindingKey ) ) ; } $ table = $ this -> junction ( ) ; $ hasMany = $ this -> getSource ( ) -> getAssociation ( $ table -> getAlias ( ) ) ; if ( $ this -> _cascadeCallbacks ) { foreach ( $ hasMany -> find ( 'all' ) -> where ( $ conditions ) -> all ( ) -> toList ( ) as $ related ) { $ table -> delete ( $ related , $ options ) ; } return true ; } $ conditions = array_merge ( $ conditions , $ hasMany -> getConditions ( ) ) ; $ table -> deleteAll ( $ conditions ) ; return true ; }
docstring: Clear out the data in the junction table for a given entity.
  
  @param \Cake\Datasource\EntityInterface $entity The entity that started the cascading delete.
  @param array $options The options for the original delete.
  @return bool Success.
docstring_tokens: Clear out the data in the junction table for a given entity .