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:5fe7525ef0c24242d206c57a36d4899a)
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',
133 'name' => 'contact_id',
134 'type' => CRM_Utils_Type
::T_INT
,
135 'title' => ts('Contact ID'),
136 'description' => ts('FK to Contact ID'),
137 'where' => 'civicrm_website.contact_id',
138 'table_name' => 'civicrm_website',
139 'entity' => 'Website',
140 'bao' => 'CRM_Core_BAO_Website',
142 'FKClassName' => 'CRM_Contact_DAO_Contact',
144 'label' => ts("Contact"),
150 'type' => CRM_Utils_Type
::T_STRING
,
151 'title' => ts('Website'),
152 'description' => ts('Website'),
156 'where' => 'civicrm_website.url',
157 'headerPattern' => '/Website/i',
158 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
160 'table_name' => 'civicrm_website',
161 'entity' => 'Website',
162 'bao' => 'CRM_Core_BAO_Website',
169 'website_type_id' => [
170 'name' => 'website_type_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Website Type'),
173 'description' => ts('Which Website type does this website belong to.'),
174 'where' => 'civicrm_website.website_type_id',
175 'table_name' => 'civicrm_website',
176 'entity' => 'Website',
177 'bao' => 'CRM_Core_BAO_Website',
182 'pseudoconstant' => [
183 'optionGroupName' => 'website_type',
184 'optionEditPath' => 'civicrm/admin/options/website_type',
189 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
191 return Civi
::$statics[__CLASS__
]['fields'];
195 * Return a mapping from field-name to the corresponding key (as used in fields()).
198 * Array(string $name => string $uniqueName).
200 public static function &fieldKeys() {
201 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
202 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
204 return Civi
::$statics[__CLASS__
]['fieldKeys'];
208 * Returns the names of this table
212 public static function getTableName() {
213 return self
::$_tableName;
217 * Returns if this table needs to be logged
221 public function getLog() {
226 * Returns the list of fields that can be imported
228 * @param bool $prefix
232 public static function &import($prefix = FALSE) {
233 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'website', $prefix, []);
238 * Returns the list of fields that can be exported
240 * @param bool $prefix
244 public static function &export($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'website', $prefix, []);
250 * Returns the list of indices
252 * @param bool $localize
256 public static function indices($localize = TRUE) {
258 'UI_website_type_id' => [
259 'name' => 'UI_website_type_id',
261 0 => 'website_type_id',
263 'localizable' => FALSE,
264 'sig' => 'civicrm_website::0::website_type_id',
267 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;