| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/Website.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:521615f9d64b0fcdc159ca28efaaec31) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the Website entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_Website extends CRM_Core_DAO { |
| 16 | const EXT = 'civicrm'; |
| 17 | const TABLE_ADDED = '3.2'; |
| 18 | |
| 19 | /** |
| 20 | * Static instance to hold the table name. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public static $_tableName = 'civicrm_website'; |
| 25 | |
| 26 | /** |
| 27 | * Icon associated with this entity. |
| 28 | * |
| 29 | * @var string |
| 30 | */ |
| 31 | public static $_icon = 'fa-desktop'; |
| 32 | |
| 33 | /** |
| 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 35 | * |
| 36 | * @var bool |
| 37 | */ |
| 38 | public static $_log = FALSE; |
| 39 | |
| 40 | /** |
| 41 | * Unique Website ID |
| 42 | * |
| 43 | * @var int |
| 44 | */ |
| 45 | public $id; |
| 46 | |
| 47 | /** |
| 48 | * FK to Contact ID |
| 49 | * |
| 50 | * @var int |
| 51 | */ |
| 52 | public $contact_id; |
| 53 | |
| 54 | /** |
| 55 | * Website |
| 56 | * |
| 57 | * @var string |
| 58 | */ |
| 59 | public $url; |
| 60 | |
| 61 | /** |
| 62 | * Which Website type does this website belong to. |
| 63 | * |
| 64 | * @var int |
| 65 | */ |
| 66 | public $website_type_id; |
| 67 | |
| 68 | /** |
| 69 | * Class constructor. |
| 70 | */ |
| 71 | public function __construct() { |
| 72 | $this->__table = 'civicrm_website'; |
| 73 | parent::__construct(); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Returns localized title of this entity. |
| 78 | * |
| 79 | * @param bool $plural |
| 80 | * Whether to return the plural version of the title. |
| 81 | */ |
| 82 | public static function getEntityTitle($plural = FALSE) { |
| 83 | return $plural ? ts('Websites') : ts('Website'); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Returns foreign keys and entity references. |
| 88 | * |
| 89 | * @return array |
| 90 | * [CRM_Core_Reference_Interface] |
| 91 | */ |
| 92 | public static function getReferenceColumns() { |
| 93 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 94 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
| 95 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
| 96 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 97 | } |
| 98 | return Civi::$statics[__CLASS__]['links']; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Returns all the column names of this table |
| 103 | * |
| 104 | * @return array |
| 105 | */ |
| 106 | public static function &fields() { |
| 107 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 108 | Civi::$statics[__CLASS__]['fields'] = [ |
| 109 | 'id' => [ |
| 110 | 'name' => 'id', |
| 111 | 'type' => CRM_Utils_Type::T_INT, |
| 112 | 'title' => ts('Website ID'), |
| 113 | 'description' => ts('Unique Website ID'), |
| 114 | 'required' => TRUE, |
| 115 | 'where' => 'civicrm_website.id', |
| 116 | 'table_name' => 'civicrm_website', |
| 117 | 'entity' => 'Website', |
| 118 | 'bao' => 'CRM_Core_BAO_Website', |
| 119 | 'localizable' => 0, |
| 120 | 'add' => '3.2', |
| 121 | ], |
| 122 | 'contact_id' => [ |
| 123 | 'name' => 'contact_id', |
| 124 | 'type' => CRM_Utils_Type::T_INT, |
| 125 | 'title' => ts('Contact'), |
| 126 | 'description' => ts('FK to Contact ID'), |
| 127 | 'where' => 'civicrm_website.contact_id', |
| 128 | 'table_name' => 'civicrm_website', |
| 129 | 'entity' => 'Website', |
| 130 | 'bao' => 'CRM_Core_BAO_Website', |
| 131 | 'localizable' => 0, |
| 132 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 133 | 'add' => '3.2', |
| 134 | ], |
| 135 | 'url' => [ |
| 136 | 'name' => 'url', |
| 137 | 'type' => CRM_Utils_Type::T_STRING, |
| 138 | 'title' => ts('Website'), |
| 139 | 'description' => ts('Website'), |
| 140 | 'maxlength' => 128, |
| 141 | 'size' => 30, |
| 142 | 'import' => TRUE, |
| 143 | 'where' => 'civicrm_website.url', |
| 144 | 'headerPattern' => '/Website/i', |
| 145 | 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', |
| 146 | 'export' => TRUE, |
| 147 | 'table_name' => 'civicrm_website', |
| 148 | 'entity' => 'Website', |
| 149 | 'bao' => 'CRM_Core_BAO_Website', |
| 150 | 'localizable' => 0, |
| 151 | 'html' => [ |
| 152 | 'type' => 'Text', |
| 153 | ], |
| 154 | 'add' => '3.2', |
| 155 | ], |
| 156 | 'website_type_id' => [ |
| 157 | 'name' => 'website_type_id', |
| 158 | 'type' => CRM_Utils_Type::T_INT, |
| 159 | 'title' => ts('Website Type'), |
| 160 | 'description' => ts('Which Website type does this website belong to.'), |
| 161 | 'where' => 'civicrm_website.website_type_id', |
| 162 | 'table_name' => 'civicrm_website', |
| 163 | 'entity' => 'Website', |
| 164 | 'bao' => 'CRM_Core_BAO_Website', |
| 165 | 'localizable' => 0, |
| 166 | 'html' => [ |
| 167 | 'type' => 'Select', |
| 168 | ], |
| 169 | 'pseudoconstant' => [ |
| 170 | 'optionGroupName' => 'website_type', |
| 171 | 'optionEditPath' => 'civicrm/admin/options/website_type', |
| 172 | ], |
| 173 | 'add' => '3.2', |
| 174 | ], |
| 175 | ]; |
| 176 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 177 | } |
| 178 | return Civi::$statics[__CLASS__]['fields']; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 183 | * |
| 184 | * @return array |
| 185 | * Array(string $name => string $uniqueName). |
| 186 | */ |
| 187 | public static function &fieldKeys() { |
| 188 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 189 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 190 | } |
| 191 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Returns the names of this table |
| 196 | * |
| 197 | * @return string |
| 198 | */ |
| 199 | public static function getTableName() { |
| 200 | return self::$_tableName; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Returns if this table needs to be logged |
| 205 | * |
| 206 | * @return bool |
| 207 | */ |
| 208 | public function getLog() { |
| 209 | return self::$_log; |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Returns the list of fields that can be imported |
| 214 | * |
| 215 | * @param bool $prefix |
| 216 | * |
| 217 | * @return array |
| 218 | */ |
| 219 | public static function &import($prefix = FALSE) { |
| 220 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []); |
| 221 | return $r; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Returns the list of fields that can be exported |
| 226 | * |
| 227 | * @param bool $prefix |
| 228 | * |
| 229 | * @return array |
| 230 | */ |
| 231 | public static function &export($prefix = FALSE) { |
| 232 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []); |
| 233 | return $r; |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Returns the list of indices |
| 238 | * |
| 239 | * @param bool $localize |
| 240 | * |
| 241 | * @return array |
| 242 | */ |
| 243 | public static function indices($localize = TRUE) { |
| 244 | $indices = [ |
| 245 | 'UI_website_type_id' => [ |
| 246 | 'name' => 'UI_website_type_id', |
| 247 | 'field' => [ |
| 248 | 0 => 'website_type_id', |
| 249 | ], |
| 250 | 'localizable' => FALSE, |
| 251 | 'sig' => 'civicrm_website::0::website_type_id', |
| 252 | ], |
| 253 | ]; |
| 254 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 255 | } |
| 256 | |
| 257 | } |