xml/templates/dao.tpl - Centralize export() / import() logic
[civicrm-core.git] / CRM / Contact / DAO / GroupNesting.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Contact/GroupNesting.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:27daca1d6d4359440b4b23c02d8f6d9d)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Contact_DAO_GroupNesting extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_group_nesting';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * Relationship ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * ID of the child group
91 *
92 * @var int unsigned
93 */
94 public $child_group_id;
95 /**
96 * ID of the parent group
97 *
98 * @var int unsigned
99 */
100 public $parent_group_id;
101 /**
102 * class constructor
103 *
104 * @return civicrm_group_nesting
105 */
106 function __construct() {
107 $this->__table = 'civicrm_group_nesting';
108 parent::__construct();
109 }
110 /**
111 * Returns foreign keys and entity references
112 *
113 * @return array
114 * [CRM_Core_Reference_Interface]
115 */
116 static function getReferenceColumns() {
117 if (!self::$_links) {
118 self::$_links = static ::createReferenceColumns(__CLASS__);
119 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'child_group_id', 'civicrm_group', 'id');
120 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_group_id', 'civicrm_group', 'id');
121 }
122 return self::$_links;
123 }
124 /**
125 * Returns all the column names of this table
126 *
127 * @return array
128 */
129 static function &fields() {
130 if (!(self::$_fields)) {
131 self::$_fields = array(
132 'id' => array(
133 'name' => 'id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Group Nesting ID') ,
136 'description' => 'Relationship ID',
137 'required' => true,
138 ) ,
139 'child_group_id' => array(
140 'name' => 'child_group_id',
141 'type' => CRM_Utils_Type::T_INT,
142 'title' => ts('Child Group') ,
143 'description' => 'ID of the child group',
144 'required' => true,
145 'FKClassName' => 'CRM_Contact_DAO_Group',
146 ) ,
147 'parent_group_id' => array(
148 'name' => 'parent_group_id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Parent Group') ,
151 'description' => 'ID of the parent group',
152 'required' => true,
153 'FKClassName' => 'CRM_Contact_DAO_Group',
154 ) ,
155 );
156 }
157 return self::$_fields;
158 }
159 /**
160 * Returns an array containing, for each field, the arary key used for that
161 * field in self::$_fields.
162 *
163 * @return array
164 */
165 static function &fieldKeys() {
166 if (!(self::$_fieldKeys)) {
167 self::$_fieldKeys = array(
168 'id' => 'id',
169 'child_group_id' => 'child_group_id',
170 'parent_group_id' => 'parent_group_id',
171 );
172 }
173 return self::$_fieldKeys;
174 }
175 /**
176 * Returns the names of this table
177 *
178 * @return string
179 */
180 static function getTableName() {
181 return self::$_tableName;
182 }
183 /**
184 * Returns if this table needs to be logged
185 *
186 * @return boolean
187 */
188 function getLog() {
189 return self::$_log;
190 }
191 /**
192 * Returns the list of fields that can be imported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
198 static function &import($prefix = false) {
199 if (!(self::$_import)) {
200 self::$_import = array();
201 $fields = self::fields();
202 foreach($fields as $name => $field) {
203 if (CRM_Utils_Array::value('import', $field)) {
204 if ($prefix) {
205 self::$_import['group_nesting'] = & $fields[$name];
206 } else {
207 self::$_import[$name] = & $fields[$name];
208 }
209 }
210 }
211 }
212 return self::$_import;
213 }
214 /**
215 * Returns the list of fields that can be exported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
221 static function &export($prefix = false) {
222 if (!(self::$_export)) {
223 self::$_export = array();
224 $fields = self::fields();
225 foreach($fields as $name => $field) {
226 if (CRM_Utils_Array::value('export', $field)) {
227 if ($prefix) {
228 self::$_export['group_nesting'] = & $fields[$name];
229 } else {
230 self::$_export[$name] = & $fields[$name];
231 }
232 }
233 }
234 }
235 return self::$_export;
236 }
237}