Skip to content

Commit

Permalink
Merge pull request #9 from juanse254/Contact_to_contactinterface
Browse files Browse the repository at this point in the history
switched from Contact to ContactInterface in match()
  • Loading branch information
mirodietiker committed Jul 20, 2015
2 parents 873856d + 49c082a commit 89ef346
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;
use Drupal\crm_core_match\Plugin\crm_core_match\engine\MatchEngineBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -75,7 +76,7 @@ public static function create(ContainerInterface $container, array $configuratio
/**
* {@inheritdoc}
*/
public function match(Contact $contact) {
public function match(ContactInterface $contact) {
$ids = array();
/* @var \Drupal\crm_core_default_matching_engine\Entity\MatchingRule $matching_rule */
$matching_rule = $this->entityManager->getStorage('crm_core_default_engine_rule')->load($contact->bundle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Drupal\crm_core_default_matching_engine\Plugin\crm_core_match\field;

use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;

/**
Expand Down Expand Up @@ -41,7 +42,7 @@ public function operators($field_info = NULL) {
*
* @todo Update to new query API.
*/
public function match(Contact $contact, $property = 'value') {
public function match(ContactInterface $contact, $property = 'value') {
$results = array();
$field_item = 'value';
$field = field_get_items('crm_core_contact', $contact, $rule->field_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;
use Drupal\crm_core_default_matching_engine\Plugin\crm_core_match\engine\DefaultMatchingEngine;
use Drupal\field\FieldConfigInterface;
Expand Down Expand Up @@ -139,7 +140,7 @@ public function getWeight($property = 'value') {
/**
* {@inheritdoc}
*/
public function match(Contact $contact, $property = 'value') {
public function match(ContactInterface $contact, $property = 'value') {

$ids = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Drupal\crm_core_default_matching_engine\Plugin\crm_core_match\field;

use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;

/**
Expand Down Expand Up @@ -145,5 +146,5 @@ public function getWeight($property = 'value');
* );
* @end
*/
public function match(Contact $contact, $property = 'value');
public function match(ContactInterface $contact, $property = 'value');
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Drupal\crm_core_default_matching_engine\Plugin\crm_core_match\field;

use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;

/**
Expand All @@ -27,7 +28,7 @@ public function getOperators($property = 'value') {
/**
* {@inheritdoc}
*/
public function match(Contact $contact, $property = 'value') {
public function match(ContactInterface $contact, $property = 'value') {
return array();
}

Expand Down
3 changes: 2 additions & 1 deletion modules/crm_core_match/src/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Config\Config;
use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;
use Drupal\crm_core_match\Plugin\crm_core_match\engine\MatchEngineInterface;

Expand Down Expand Up @@ -128,7 +129,7 @@ public function getEngines() {
*
* @todo Check engine status. Skip disabled engines.
*/
public function match(Contact $contact) {
public function match(ContactInterface $contact) {
$ids = array();

foreach ($this->getEngines() as $engine) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Drupal\crm_core_match\Plugin\crm_core_match\engine;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -67,5 +68,5 @@ public static function create(ContainerInterface $container, array $configuratio
*
* @see MatchEngineInterface::match()
*/
public abstract function match(Contact $contact);
public abstract function match(ContactInterface $contact);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Drupal\crm_core_match\Plugin\crm_core_match\engine;

use Drupal\crm_core_contact\ContactInterface;
use Drupal\crm_core_contact\Entity\Contact;

/**
Expand All @@ -27,5 +28,5 @@ interface MatchEngineInterface {
* @return int[]
* An array of entity ids for potential matches.
*/
public function match(Contact $contact);
public function match(ContactInterface $contact);
}

0 comments on commit 89ef346

Please sign in to comment.