Reformat DAO files to pass linting and use short array syntax
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
index fb0465b855a26a008c6571bbfdc20bd108bce355..3526b30c3235282220c1f80a5395593fe072777c 100644 (file)
@@ -1,29 +1,5 @@
 <?php
-/*
-+--------------------------------------------------------------------+
-| CiviCRM version 4.7                                                |
-+--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2017                                |
-+--------------------------------------------------------------------+
-| This file is a part of CiviCRM.                                    |
-|                                                                    |
-| CiviCRM is free software; you can copy, modify, and distribute it  |
-| under the terms of the GNU Affero General Public License           |
-| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
-|                                                                    |
-| CiviCRM is distributed in the hope that it will be useful, but     |
-| WITHOUT ANY WARRANTY; without even the implied warranty of         |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
-| See the GNU Affero General Public License for more details.        |
-|                                                                    |
-| You should have received a copy of the GNU Affero General Public   |
-| License and the CiviCRM Licensing Exception along                  |
-| with this program; if not, contact CiviCRM LLC                     |
-| at info[AT]civicrm[DOT]org. If you have questions about the        |
-| GNU Affero General Public License or the licensing of CiviCRM,     |
-| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
-+--------------------------------------------------------------------+
-*/
+
 /**
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2017
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
  * (GenCodeChecksum:fed218269d1baab495490130b4e2442a)
  */
-require_once 'CRM/Core/DAO.php';
-require_once 'CRM/Utils/Type.php';
+
 /**
- * CRM_Price_DAO_PriceFieldValue constructor.
+ * Database access object for the PriceFieldValue entity.
  */
 class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
+
   /**
    * Static instance to hold the table name.
    *
    * @var string
    */
   static $_tableName = 'civicrm_price_field_value';
+
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
-   * @var boolean
+   * @var bool
    */
-  static $_log = false;
+  static $_log = FALSE;
+
   /**
    * Price Field Value
    *
    * @var int unsigned
    */
   public $id;
+
   /**
    * FK to civicrm_price_field
    *
    * @var int unsigned
    */
   public $price_field_id;
+
   /**
    * Price field option name
    *
    * @var string
    */
   public $name;
+
   /**
    * Price field option label
    *
    * @var string
    */
   public $label;
+
   /**
    * >Price field option description.
    *
    * @var text
    */
   public $description;
+
   /**
    * Price field option pre help text.
    *
    * @var text
    */
   public $help_pre;
+
   /**
    * Price field option post field help.
    *
    * @var text
    */
   public $help_post;
+
   /**
    * Price field option amount
    *
    * @var float
    */
   public $amount;
+
   /**
    * Number of participants per field option
    *
    * @var int unsigned
    */
   public $count;
+
   /**
    * Max number of participants per field options
    *
    * @var int unsigned
    */
   public $max_value;
+
   /**
    * Order in which the field options should appear
    *
    * @var int
    */
   public $weight;
+
   /**
    * FK to Membership Type
    *
    * @var int unsigned
    */
   public $membership_type_id;
+
   /**
    * Number of terms for this membership
    *
    * @var int unsigned
    */
   public $membership_num_terms;
+
   /**
    * Is this default price field option
    *
    * @var boolean
    */
   public $is_default;
+
   /**
    * Is this price field value active
    *
    * @var boolean
    */
   public $is_active;
+
   /**
    * FK to Financial Type.
    *
    * @var int unsigned
    */
   public $financial_type_id;
+
   /**
    * Portion of total amount which is NOT tax deductible.
    *
    * @var float
    */
   public $non_deductible_amount;
+
   /**
    * Implicit FK to civicrm_option_group with name = 'visibility'
    *
    * @var int unsigned
    */
   public $visibility_id;
+
   /**
    * Class constructor.
    */
-  function __construct() {
+  public function __construct() {
     $this->__table = 'civicrm_price_field_value';
     parent::__construct();
   }
+
   /**
    * Returns foreign keys and entity references.
    *
    * @return array
    *   [CRM_Core_Reference_Interface]
    */
-  static function getReferenceColumns() {
+  public static function getReferenceColumns() {
     if (!isset(Civi::$statics[__CLASS__]['links'])) {
       Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
-      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
-      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
-      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id');
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
     return Civi::$statics[__CLASS__]['links'];
   }
+
   /**
    * Returns all the column names of this table
    *
    * @return array
    */
-  static function &fields() {
+  public static function &fields() {
     if (!isset(Civi::$statics[__CLASS__]['fields'])) {
-      Civi::$statics[__CLASS__]['fields'] = array(
-        'id' => array(
+      Civi::$statics[__CLASS__]['fields'] = [
+        'id' => [
           'name' => 'id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Price Field Value ID') ,
+          'title' => ts('Price Field Value ID'),
           'description' => 'Price Field Value',
-          'required' => true,
+          'required' => TRUE,
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-        ,
-        'price_field_id' => array(
+        ],
+        'price_field_id' => [
           'name' => 'price_field_id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Price Field') ,
+          'title' => ts('Price Field'),
           'description' => 'FK to civicrm_price_field',
-          'required' => true,
+          'required' => TRUE,
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
           'FKClassName' => 'CRM_Price_DAO_PriceField',
-        ,
-        'name' => array(
+        ],
+        'name' => [
           'name' => 'name',
           'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Name') ,
+          'title' => ts('Name'),
           'description' => 'Price field option name',
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
@@ -223,14 +221,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'label' => array(
+          ],
+        ],
+        'label' => [
           'name' => 'label',
           'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Label') ,
+          'title' => ts('Label'),
           'description' => 'Price field option label',
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
@@ -238,14 +236,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 1,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'description' => array(
+          ],
+        ],
+        'description' => [
           'name' => 'description',
           'type' => CRM_Utils_Type::T_TEXT,
-          'title' => ts('Description') ,
+          'title' => ts('Description'),
           'description' => '>Price field option description.',
           'rows' => 2,
           'cols' => 60,
@@ -254,14 +252,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 1,
-          'html' => array(
+          'html' => [
             'type' => 'TextArea',
-          ,
-        ,
-        'help_pre' => array(
+          ],
+        ],
+        'help_pre' => [
           'name' => 'help_pre',
           'type' => CRM_Utils_Type::T_TEXT,
-          'title' => ts('Help Pre') ,
+          'title' => ts('Help Pre'),
           'description' => 'Price field option pre help text.',
           'rows' => 2,
           'cols' => 60,
@@ -270,14 +268,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 1,
-          'html' => array(
+          'html' => [
             'type' => 'TextArea',
-          ,
-        ,
-        'help_post' => array(
+          ],
+        ],
+        'help_post' => [
           'name' => 'help_post',
           'type' => CRM_Utils_Type::T_TEXT,
-          'title' => ts('Help Post') ,
+          'title' => ts('Help Post'),
           'description' => 'Price field option post field help.',
           'rows' => 2,
           'cols' => 60,
@@ -286,74 +284,74 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 1,
-          'html' => array(
+          'html' => [
             'type' => 'TextArea',
-          ,
-        ,
-        'amount' => array(
+          ],
+        ],
+        'amount' => [
           'name' => 'amount',
           'type' => CRM_Utils_Type::T_MONEY,
-          'title' => ts('Amount') ,
+          'title' => ts('Amount'),
           'description' => 'Price field option amount',
-          'required' => true,
-          'precision' => array(
+          'required' => TRUE,
+          'precision' => [
             18,
             9
-          ,
+          ],
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'count' => array(
+          ],
+        ],
+        'count' => [
           'name' => 'count',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Count') ,
+          'title' => ts('Count'),
           'description' => 'Number of participants per field option',
           'default' => 'NULL',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'max_value' => array(
+          ],
+        ],
+        'max_value' => [
           'name' => 'max_value',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Max Value') ,
+          'title' => ts('Max Value'),
           'description' => 'Max number of participants per field options',
           'default' => 'NULL',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'weight' => array(
+          ],
+        ],
+        'weight' => [
           'name' => 'weight',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Order') ,
+          'title' => ts('Order'),
           'description' => 'Order in which the field options should appear',
           'default' => '1',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'membership_type_id' => array(
+          ],
+        ],
+        'membership_type_id' => [
           'name' => 'membership_type_id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Membership Type') ,
+          'title' => ts('Membership Type'),
           'description' => 'FK to Membership Type',
           'default' => 'NULL',
           'table_name' => 'civicrm_price_field_value',
@@ -361,52 +359,52 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
           'FKClassName' => 'CRM_Member_DAO_MembershipType',
-          'html' => array(
+          'html' => [
             'type' => 'Select',
-          ,
-        ,
-        'membership_num_terms' => array(
+          ],
+        ],
+        'membership_num_terms' => [
           'name' => 'membership_num_terms',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Membership Num Terms') ,
+          'title' => ts('Membership Num Terms'),
           'description' => 'Number of terms for this membership',
           'default' => 'NULL',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'is_default' => array(
+          ],
+        ],
+        'is_default' => [
           'name' => 'is_default',
           'type' => CRM_Utils_Type::T_BOOLEAN,
-          'title' => ts('Is Default Price Field Option?') ,
+          'title' => ts('Is Default Price Field Option?'),
           'description' => 'Is this default price field option',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'CheckBox',
-          ,
-        ,
-        'is_active' => array(
+          ],
+        ],
+        'is_active' => [
           'name' => 'is_active',
           'type' => CRM_Utils_Type::T_BOOLEAN,
-          'title' => ts('Price Field Value is Active') ,
+          'title' => ts('Price Field Value is Active'),
           'description' => 'Is this price field value active',
           'default' => '1',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-        ,
-        'financial_type_id' => array(
+        ],
+        'financial_type_id' => [
           'name' => 'financial_type_id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Financial Type') ,
+          'title' => ts('Financial Type'),
           'description' => 'FK to Financial Type.',
           'default' => 'NULL',
           'table_name' => 'civicrm_price_field_value',
@@ -414,85 +412,89 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
           'FKClassName' => 'CRM_Financial_DAO_FinancialType',
-          'html' => array(
+          'html' => [
             'type' => 'Select',
-          ,
-          'pseudoconstant' => array(
+          ],
+          'pseudoconstant' => [
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          )
-        ,
-        'non_deductible_amount' => array(
+          ]
+        ],
+        'non_deductible_amount' => [
           'name' => 'non_deductible_amount',
           'type' => CRM_Utils_Type::T_MONEY,
-          'title' => ts('Non-deductible Amount') ,
+          'title' => ts('Non-deductible Amount'),
           'description' => 'Portion of total amount which is NOT tax deductible.',
-          'required' => true,
-          'precision' => array(
+          'required' => TRUE,
+          'precision' => [
             20,
             2
-          ,
+          ],
           'default' => '0.0',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Text',
-          ,
-        ,
-        'visibility_id' => array(
+          ],
+        ],
+        'visibility_id' => [
           'name' => 'visibility_id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Price Field Option Visibility') ,
+          'title' => ts('Price Field Option Visibility'),
           'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'',
           'default' => '1',
           'table_name' => 'civicrm_price_field_value',
           'entity' => 'PriceFieldValue',
           'bao' => 'CRM_Price_BAO_PriceFieldValue',
           'localizable' => 0,
-          'html' => array(
+          'html' => [
             'type' => 'Select',
-          ,
-          'pseudoconstant' => array(
+          ],
+          'pseudoconstant' => [
             'optionGroupName' => 'visibility',
             'optionEditPath' => 'civicrm/admin/options/visibility',
-          )
-        ,
-      );
+          ]
+        ],
+      ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
     return Civi::$statics[__CLASS__]['fields'];
   }
+
   /**
    * Return a mapping from field-name to the corresponding key (as used in fields()).
    *
    * @return array
    *   Array(string $name => string $uniqueName).
    */
-  static function &fieldKeys() {
+  public static function &fieldKeys() {
     if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
       Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
     }
     return Civi::$statics[__CLASS__]['fieldKeys'];
   }
+
   /**
    * Returns the names of this table
    *
    * @return string
    */
-  static function getTableName() {
+  public static function getTableName() {
     return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
   }
+
   /**
    * Returns if this table needs to be logged
    *
-   * @return boolean
+   * @return bool
    */
-  function getLog() {
+  public function getLog() {
     return self::$_log;
   }
+
   /**
    * Returns the list of fields that can be imported
    *
@@ -500,10 +502,11 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
    *
    * @return array
    */
-  static function &import($prefix = false) {
-    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
+  public static function &import($prefix = FALSE) {
+    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []);
     return $r;
   }
+
   /**
    * Returns the list of fields that can be exported
    *
@@ -511,15 +514,21 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
    *
    * @return array
    */
-  static function &export($prefix = false) {
-    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
+  public static function &export($prefix = FALSE) {
+    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []);
     return $r;
   }
+
   /**
    * Returns the list of indices
+   *
+   * @param bool $localize
+   *
+   * @return array
    */
   public static function indices($localize = TRUE) {
-    $indices = array();
+    $indices = [];
     return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
   }
+
 }