CRM-19438, fixed for memcached issue, since it returns string rather NULL
[civicrm-core.git] / Civi / ActionSchedule / MappingInterface.php
index b1acb7b30d0d4a97c1f6a59e28047ee72e83716d..54d28a3051c8f0014cf186703c37a7746a673da5 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 
 namespace Civi\ActionSchedule;
 
+/**
+ * Interface MappingInterface
+ * @package Civi\ActionSchedule
+ */
 interface MappingInterface {
 
+  /**
+   * @return mixed
+   */
+  public function getId();
+
+  /**
+   * @return string
+   */
+  public function getEntity();
+
+  /**
+   * Get a printable label for this mapping type.
+   *
+   * @return string
+   */
+  public function getLabel();
+
+  /**
+   * Get a printable label to use as the header on the 'value' filter.
+   *
+   * @return string
+   */
+  public function getValueHeader();
+
+  /**
+   * Get a printable label to use as the header on the 'status' filter.
+   *
+   * @return string
+   */
+  public function getStatusHeader();
+
   /**
    * Get a list of value options.
    *
@@ -59,26 +94,42 @@ interface MappingInterface {
   public function getDateFields();
 
   /**
-   * FIXME: Unsure. Not sure how it differs from getRecipientTypes... but it does...
+   * Get a list of recipient types.
+   *
+   * Note: A single schedule may filter on *zero* or *one* recipient types.
+   * When an admin chooses a value, it's stored in $schedule->recipient.
+   *
+   * @return array
+   *   array(string $value => string $label).
+   *   Ex: array('assignee' => 'Activity Assignee').
+   */
+  public function getRecipientTypes();
+
+  /**
+   * Get a list of recipients which match the given type.
+   *
+   * Note: A single schedule may filter on *multiple* recipients.
+   * When an admin chooses value(s), it's stored in $schedule->recipient_listing.
    *
    * @param string $recipientType
+   *   Ex: 'participant_role'.
    * @return array
    *   Array(mixed $name => string $label).
    *   Ex: array(1 => 'Attendee', 2 => 'Volunteer').
+   * @see getRecipientTypes
    */
   public function getRecipientListing($recipientType);
 
   /**
-   * FIXME: Unsure. Not sure how it differs from getRecipientListing... but it does...
+   * Determine whether a schedule based on this mapping is sufficiently
+   * complete.
    *
-   * @param bool|NULL $noThanksJustKidding
-   *   This is ridiculous and should not exist.
-   *   If true, don't do our main job.
+   * @param \CRM_Core_DAO_ActionSchedule $schedule
    * @return array
-   *   array(mixed $value => string $label).
-   *   Ex: array('assignee' => 'Activity Assignee').
+   *   Array (string $code => string $message).
+   *   List of error messages.
    */
-  public function getRecipientTypes($noThanksJustKidding = FALSE);
+  public function validateSchedule($schedule);
 
   /**
    * Generate a query to locate contacts who match the given
@@ -87,9 +138,11 @@ interface MappingInterface {
    * @param \CRM_Core_DAO_ActionSchedule $schedule
    * @param string $phase
    *   See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
+   * @param array $defaultParams
+   *   Default parameters that should be included with query.
    * @return \CRM_Utils_SQL_Select
    * @see RecipientBuilder
    */
-  public function createQuery($schedule, $phase);
+  public function createQuery($schedule, $phase, $defaultParams);
 
 }