5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Website.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:042da2fb78309555f5d4ecbe41d33cd0)
13 * Database access object for the Website entity.
15 class CRM_Core_DAO_Website
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_website';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-desktop';
34 * Field to show when displaying a record.
38 public static $_labelField = 'url';
41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
45 public static $_log = FALSE;
69 * Which Website type does this website belong to.
73 public $website_type_id;
78 public function __construct() {
79 $this->__table
= 'civicrm_website';
80 parent
::__construct();
84 * Returns localized title of this entity.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Websites') : ts('Website');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
103 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
105 return Civi
::$statics[__CLASS__
]['links'];
109 * Returns all the column names of this table
113 public static function &fields() {
114 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
115 Civi
::$statics[__CLASS__
]['fields'] = [
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Website ID'),
120 'description' => ts('Unique Website ID'),
122 'where' => 'civicrm_website.id',
123 'table_name' => 'civicrm_website',
124 'entity' => 'Website',
125 'bao' => 'CRM_Core_BAO_Website',
134 'name' => 'contact_id',
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Contact ID'),
137 'description' => ts('FK to Contact ID'),
138 'where' => 'civicrm_website.contact_id',
139 'table_name' => 'civicrm_website',
140 'entity' => 'Website',
141 'bao' => 'CRM_Core_BAO_Website',
143 'FKClassName' => 'CRM_Contact_DAO_Contact',
145 'label' => ts("Contact"),
151 'type' => CRM_Utils_Type
::T_STRING
,
152 'title' => ts('Website'),
153 'description' => ts('Website'),
157 'where' => 'civicrm_website.url',
158 'headerPattern' => '/Website/i',
159 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
161 'table_name' => 'civicrm_website',
162 'entity' => 'Website',
163 'bao' => 'CRM_Core_BAO_Website',
170 'website_type_id' => [
171 'name' => 'website_type_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Website Type'),
174 'description' => ts('Which Website type does this website belong to.'),
175 'where' => 'civicrm_website.website_type_id',
176 'table_name' => 'civicrm_website',
177 'entity' => 'Website',
178 'bao' => 'CRM_Core_BAO_Website',
183 'pseudoconstant' => [
184 'optionGroupName' => 'website_type',
185 'optionEditPath' => 'civicrm/admin/options/website_type',
190 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
192 return Civi
::$statics[__CLASS__
]['fields'];
196 * Return a mapping from field-name to the corresponding key (as used in fields()).
199 * Array(string $name => string $uniqueName).
201 public static function &fieldKeys() {
202 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
203 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
205 return Civi
::$statics[__CLASS__
]['fieldKeys'];
209 * Returns the names of this table
213 public static function getTableName() {
214 return self
::$_tableName;
218 * Returns if this table needs to be logged
222 public function getLog() {
227 * Returns the list of fields that can be imported
229 * @param bool $prefix
233 public static function &import($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'website', $prefix, []);
239 * Returns the list of fields that can be exported
241 * @param bool $prefix
245 public static function &export($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'website', $prefix, []);
251 * Returns the list of indices
253 * @param bool $localize
257 public static function indices($localize = TRUE) {
259 'UI_website_type_id' => [
260 'name' => 'UI_website_type_id',
262 0 => 'website_type_id',
264 'localizable' => FALSE,
265 'sig' => 'civicrm_website::0::website_type_id',
268 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;