original_string: protected function _ensureFields($entity)
      {
          $config = $this->getConfig();
          $fields = [$config['left'], $config['right']];
          $values = array_filter($entity->extract($fields));
          if (count($values) === count($fields)) {
              return;
          }
  
          $fresh = $this->_table->get($entity->get($this->_getPrimaryKey()), $fields);
          $entity->set($fresh->extract($fields), ['guard' => false]);
  
          foreach ($fields as $field) {
              $entity->setDirty($field, false);
          }
      }
code: protected function _ensureFields($entity)
      {
          $config = $this->getConfig();
          $fields = [$config['left'], $config['right']];
          $values = array_filter($entity->extract($fields));
          if (count($values) === count($fields)) {
              return;
          }
  
          $fresh = $this->_table->get($entity->get($this->_getPrimaryKey()), $fields);
          $entity->set($fresh->extract($fields), ['guard' => false]);
  
          foreach ($fields as $field) {
              $entity->setDirty($field, false);
          }
      }
code_tokens: protected function _ensureFields ( $ entity ) { $ config = $ this -> getConfig ( ) ; $ fields = [ $ config [ 'left' ] , $ config [ 'right' ] ] ; $ values = array_filter ( $ entity -> extract ( $ fields ) ) ; if ( count ( $ values ) === count ( $ fields ) ) { return ; } $ fresh = $ this -> _table -> get ( $ entity -> get ( $ this -> _getPrimaryKey ( ) ) , $ fields ) ; $ entity -> set ( $ fresh -> extract ( $ fields ) , [ 'guard' => false ] ) ; foreach ( $ fields as $ field ) { $ entity -> setDirty ( $ field , false ) ; } }
docstring: Ensures that the provided entity contains non-empty values for the left and
  right fields
  
  @param \Cake\Datasource\EntityInterface $entity The entity to ensure fields for
  @return void
docstring_tokens: Ensures that the provided entity contains non - empty values for the left and right fields