5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:46c21503a7dd4e0e8dc4b2221ae8bd0a)
13 * Database access object for the PremiumsProduct entity.
15 class CRM_Contribute_DAO_PremiumsProduct
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.4';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_premiums_product';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * Foreign key to premiums settings record.
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
53 * Foreign key to each product object.
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
69 * FK to Financial Type.
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
75 public $financial_type_id;
80 public function __construct() {
81 $this->__table
= 'civicrm_premiums_product';
82 parent
::__construct();
86 * Returns localized title of this entity.
89 * Whether to return the plural version of the title.
91 public static function getEntityTitle($plural = FALSE) {
92 return $plural ?
ts('Product Premiums') : ts('Product Premium');
96 * Returns foreign keys and entity references.
99 * [CRM_Core_Reference_Interface]
101 public static function getReferenceColumns() {
102 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
103 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
104 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
105 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
106 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
107 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
109 return Civi
::$statics[__CLASS__
]['links'];
113 * Returns all the column names of this table
117 public static function &fields() {
118 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
119 Civi
::$statics[__CLASS__
]['fields'] = [
122 'type' => CRM_Utils_Type
::T_INT
,
123 'title' => ts('Premium Product ID'),
124 'description' => ts('Contribution ID'),
126 'where' => 'civicrm_premiums_product.id',
127 'table_name' => 'civicrm_premiums_product',
128 'entity' => 'PremiumsProduct',
129 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
138 'name' => 'premiums_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Premium ID'),
141 'description' => ts('Foreign key to premiums settings record.'),
143 'where' => 'civicrm_premiums_product.premiums_id',
144 'table_name' => 'civicrm_premiums_product',
145 'entity' => 'PremiumsProduct',
146 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
148 'FKClassName' => 'CRM_Contribute_DAO_Premium',
150 'label' => ts("Premium"),
155 'name' => 'product_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Product ID'),
158 'description' => ts('Foreign key to each product object.'),
160 'where' => 'civicrm_premiums_product.product_id',
161 'table_name' => 'civicrm_premiums_product',
162 'entity' => 'PremiumsProduct',
163 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
165 'FKClassName' => 'CRM_Contribute_DAO_Product',
167 'label' => ts("Product"),
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Order'),
176 'where' => 'civicrm_premiums_product.weight',
177 'table_name' => 'civicrm_premiums_product',
178 'entity' => 'PremiumsProduct',
179 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
183 'financial_type_id' => [
184 'name' => 'financial_type_id',
185 'type' => CRM_Utils_Type
::T_INT
,
186 'title' => ts('Financial Type ID'),
187 'description' => ts('FK to Financial Type.'),
188 'where' => 'civicrm_premiums_product.financial_type_id',
190 'table_name' => 'civicrm_premiums_product',
191 'entity' => 'PremiumsProduct',
192 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
194 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
196 'label' => ts("Financial Type"),
198 'pseudoconstant' => [
199 'table' => 'civicrm_financial_type',
201 'labelColumn' => 'name',
206 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
208 return Civi
::$statics[__CLASS__
]['fields'];
212 * Return a mapping from field-name to the corresponding key (as used in fields()).
215 * Array(string $name => string $uniqueName).
217 public static function &fieldKeys() {
218 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
219 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
221 return Civi
::$statics[__CLASS__
]['fieldKeys'];
225 * Returns the names of this table
229 public static function getTableName() {
230 return self
::$_tableName;
234 * Returns if this table needs to be logged
238 public function getLog() {
243 * Returns the list of fields that can be imported
245 * @param bool $prefix
249 public static function &import($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
255 * Returns the list of fields that can be exported
257 * @param bool $prefix
261 public static function &export($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
267 * Returns the list of indices
269 * @param bool $localize
273 public static function indices($localize = TRUE) {
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;