Drupal 7 致命错误:CRMCoreContactController::save($contact)的声明必须与EntityApicController::save兼容

Drupal 7 致命错误:CRMCoreContactController::save($contact)的声明必须与EntityApicController::save兼容,drupal-7,Drupal 7,我最近安装了CRM Core以及运行它所需的所有缺失模块。不幸的是,我需要这个模块的项目,我正在工作,但第二次我安装他们,我得到了这个错误 致命错误:CRMCoreContactController::save($contact)的声明必须与第111行/opt/lampp/htdocs/drupal/modules/crm_core/modules/crm_core_contact/includes/crm_core_contact.inc中的EntityAPIController::save(

我最近安装了CRM Core以及运行它所需的所有缺失模块。不幸的是,我需要这个模块的项目,我正在工作,但第二次我安装他们,我得到了这个错误

致命错误:CRMCoreContactController::save($contact)的声明必须与第111行/opt/lampp/htdocs/drupal/modules/crm_core/modules/crm_core_contact/includes/crm_core_contact.inc中的EntityAPIController::save($entity,?DatabaseTransaction$transaction=NULL)兼容

我回到代码中,看不出要更改什么。第111行是代码的最后一行。我也会把代码贴上去也许有人知道怎么解决这个问题

  <?php

/**
 * CRM Contact Entity Class.
 */
class CRMCoreContactEntity extends Entity {

  protected function defaultLabel() {
    return crm_core_contact_label($this);
  }

  protected function defaultUri() {
    return array(
      'path' => 'crm-core/contact/' . $this->identifier(),
      'options' => array(
        'absolute' => TRUE,
      ),
    );
  }

  /**
   * Method for de-duplicating contacts.
   *
   * Allows various modules to identify duplicate contact records through
   * hook_crm_core_contact_match. This function should implement it's
   * own contact matching scheme.
   *
   * @return array
   *   Array of matched contact IDs.
   */
  public function match() {

    $checks = & drupal_static(__FUNCTION__);
    $matches = array();

    if (!isset($checks->processed)) {
      $checks = new stdClass();
      $checks->engines = module_implements('crm_core_contact_match');
      $checks->processed = 1;
    }

    // Pass in the contact and the matches array as references.
    // This will allow various matching tools to modify the contact
    // and the list of matches.
    $values = array(
      'contact' => &$this,
      'matches' => &$matches,
    );
    foreach ($checks->engines as $module) {
      module_invoke($module, 'crm_core_contact_match', $values);
    }

    // It's up to implementing modules to handle the matching logic.
    // Most often, the match to be used should be the one
    // at the top of the stack.
    return $matches;
  }
}

/**
 * @file
 * Controller class for contacts.
 *
 * This extends the DrupalDefaultEntityController class, adding required
 * special handling for contact objects.
 */
class CRMCoreContactController extends EntityAPIController {

  public $revisionKey = 'vid';
  public $revisionTable = 'crm_core_contact_revision';

  /**
   * Create a basic contact object.
   */
  public function create(array $values = array()) {
    global $user;
    $values += array(
      'contact_id' => '',
      'vid' => '',
      'uid' => $user->uid,
      'created' => REQUEST_TIME,
      'changed' => REQUEST_TIME,
    );

    return parent::create($values);
  }

  /**
   * Update contact object before saving revision.
   */
  protected function saveRevision($entity) {
    if (!isset($entity->log)) {
      $entity->log = '';
    }
    $entity->is_new_revision = TRUE;
    $entity->uid = $GLOBALS['user']->uid;

    return parent::saveRevision($entity);
  }

  /**
   * Updates 'changed' property on save.
   */
  public function save($contact) {
    $contact->changed = REQUEST_TIME;
    // Storing formatted contact label for autocomplete lookups.
    $contact->name = crm_core_contact_label($contact);

    return parent::save($contact);
  }
}
正在更改

public function save($contact)


应该可以工作。

您需要从PHP7.x+切换到PHP5.6。这将解决此错误

如果没有关于您正在运行的系统的更多详细信息,就无法为您提供关于如何降级的更多建议,但是关于这个主题有很多指南

public function save($contact, DatabaseTransaction $transaction = NULL)