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:9176466bab7c06d5ace2080bfcfe51d6)
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',
130 'name' => 'contact_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Contact'),
133 'description' => ts('FK to Contact ID'),
134 'where' => 'civicrm_website.contact_id',
135 'table_name' => 'civicrm_website',
136 'entity' => 'Website',
137 'bao' => 'CRM_Core_BAO_Website',
139 'FKClassName' => 'CRM_Contact_DAO_Contact',
144 'type' => CRM_Utils_Type
::T_STRING
,
145 'title' => ts('Website'),
146 'description' => ts('Website'),
150 'where' => 'civicrm_website.url',
151 'headerPattern' => '/Website/i',
152 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
154 'table_name' => 'civicrm_website',
155 'entity' => 'Website',
156 'bao' => 'CRM_Core_BAO_Website',
163 'website_type_id' => [
164 'name' => 'website_type_id',
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Website Type'),
167 'description' => ts('Which Website type does this website belong to.'),
168 'where' => 'civicrm_website.website_type_id',
169 'table_name' => 'civicrm_website',
170 'entity' => 'Website',
171 'bao' => 'CRM_Core_BAO_Website',
176 'pseudoconstant' => [
177 'optionGroupName' => 'website_type',
178 'optionEditPath' => 'civicrm/admin/options/website_type',
183 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
185 return Civi
::$statics[__CLASS__
]['fields'];
189 * Return a mapping from field-name to the corresponding key (as used in fields()).
192 * Array(string $name => string $uniqueName).
194 public static function &fieldKeys() {
195 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
196 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
198 return Civi
::$statics[__CLASS__
]['fieldKeys'];
202 * Returns the names of this table
206 public static function getTableName() {
207 return self
::$_tableName;
211 * Returns if this table needs to be logged
215 public function getLog() {
220 * Returns the list of fields that can be imported
222 * @param bool $prefix
226 public static function &import($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'website', $prefix, []);
232 * Returns the list of fields that can be exported
234 * @param bool $prefix
238 public static function &export($prefix = FALSE) {
239 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'website', $prefix, []);
244 * Returns the list of indices
246 * @param bool $localize
250 public static function indices($localize = TRUE) {
252 'UI_website_type_id' => [
253 'name' => 'UI_website_type_id',
255 0 => 'website_type_id',
257 'localizable' => FALSE,
258 'sig' => 'civicrm_website::0::website_type_id',
261 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;