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:7ef66a990830d03a02dd59b7b6f0d2cb)
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;
50 * @var int|string|null
51 * (SQL type: int unsigned)
52 * Note that values will be retrieved from the database as a string.
59 * @var int|string|null
60 * (SQL type: int unsigned)
61 * Note that values will be retrieved from the database as a string.
69 * (SQL type: varchar(128))
70 * Note that values will be retrieved from the database as a string.
75 * Which Website type does this website belong to.
77 * @var int|string|null
78 * (SQL type: int unsigned)
79 * Note that values will be retrieved from the database as a string.
81 public $website_type_id;
86 public function __construct() {
87 $this->__table
= 'civicrm_website';
88 parent
::__construct();
92 * Returns localized title of this entity.
95 * Whether to return the plural version of the title.
97 public static function getEntityTitle($plural = FALSE) {
98 return $plural ?
ts('Websites') : ts('Website');
102 * Returns foreign keys and entity references.
105 * [CRM_Core_Reference_Interface]
107 public static function getReferenceColumns() {
108 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
109 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
110 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
111 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
113 return Civi
::$statics[__CLASS__
]['links'];
117 * Returns all the column names of this table
121 public static function &fields() {
122 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
123 Civi
::$statics[__CLASS__
]['fields'] = [
126 'type' => CRM_Utils_Type
::T_INT
,
127 'title' => ts('Website ID'),
128 'description' => ts('Unique Website ID'),
130 'where' => 'civicrm_website.id',
131 'table_name' => 'civicrm_website',
132 'entity' => 'Website',
133 'bao' => 'CRM_Core_BAO_Website',
142 'name' => 'contact_id',
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Contact ID'),
145 'description' => ts('FK to Contact ID'),
146 'where' => 'civicrm_website.contact_id',
147 'table_name' => 'civicrm_website',
148 'entity' => 'Website',
149 'bao' => 'CRM_Core_BAO_Website',
151 'FKClassName' => 'CRM_Contact_DAO_Contact',
153 'label' => ts("Contact"),
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Website'),
161 'description' => ts('Website'),
165 'where' => 'civicrm_website.url',
166 'headerPattern' => '/Website/i',
167 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
169 'table_name' => 'civicrm_website',
170 'entity' => 'Website',
171 'bao' => 'CRM_Core_BAO_Website',
178 'website_type_id' => [
179 'name' => 'website_type_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Website Type'),
182 'description' => ts('Which Website type does this website belong to.'),
183 'where' => 'civicrm_website.website_type_id',
184 'table_name' => 'civicrm_website',
185 'entity' => 'Website',
186 'bao' => 'CRM_Core_BAO_Website',
191 'pseudoconstant' => [
192 'optionGroupName' => 'website_type',
193 'optionEditPath' => 'civicrm/admin/options/website_type',
198 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
200 return Civi
::$statics[__CLASS__
]['fields'];
204 * Return a mapping from field-name to the corresponding key (as used in fields()).
207 * Array(string $name => string $uniqueName).
209 public static function &fieldKeys() {
210 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
211 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
213 return Civi
::$statics[__CLASS__
]['fieldKeys'];
217 * Returns the names of this table
221 public static function getTableName() {
222 return self
::$_tableName;
226 * Returns if this table needs to be logged
230 public function getLog() {
235 * Returns the list of fields that can be imported
237 * @param bool $prefix
241 public static function &import($prefix = FALSE) {
242 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'website', $prefix, []);
247 * Returns the list of fields that can be exported
249 * @param bool $prefix
253 public static function &export($prefix = FALSE) {
254 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'website', $prefix, []);
259 * Returns the list of indices
261 * @param bool $localize
265 public static function indices($localize = TRUE) {
267 'UI_website_type_id' => [
268 'name' => 'UI_website_type_id',
270 0 => 'website_type_id',
272 'localizable' => FALSE,
273 'sig' => 'civicrm_website::0::website_type_id',
276 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;