|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace mod_link\models\Map; |
|
4
|
|
|
|
|
5
|
|
|
use Propel\Runtime\Propel; |
|
6
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
|
7
|
|
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait; |
|
8
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
|
9
|
|
|
use Propel\Runtime\DataFetcher\DataFetcherInterface; |
|
10
|
|
|
use Propel\Runtime\Exception\PropelException; |
|
11
|
|
|
use Propel\Runtime\Map\RelationMap; |
|
12
|
|
|
use Propel\Runtime\Map\TableMap; |
|
13
|
|
|
use Propel\Runtime\Map\TableMapTrait; |
|
14
|
|
|
use mod_link\models\PageLink; |
|
15
|
|
|
use mod_link\models\PageLinkQuery; |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* This class defines the structure of the 'page_link' table. |
|
20
|
|
|
* |
|
21
|
|
|
* |
|
22
|
|
|
* |
|
23
|
|
|
* This map class is used by Propel to do runtime db structure discovery. |
|
|
|
|
|
|
24
|
|
|
* For example, the createSelectSql() method checks the type of a given column used in an |
|
25
|
|
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive |
|
26
|
|
|
* (i.e. if it's a text column type). |
|
27
|
|
|
* |
|
28
|
|
|
*/ |
|
|
|
|
|
|
29
|
|
|
class PageLinkTableMap extends TableMap |
|
30
|
|
|
{ |
|
|
|
|
|
|
31
|
|
|
use InstancePoolTrait; |
|
32
|
|
|
use TableMapTrait; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* The (dot-path) name of this class |
|
36
|
|
|
*/ |
|
37
|
|
|
const CLASS_NAME = 'mod_link.models.Map.PageLinkTableMap'; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* The default database name for this class |
|
41
|
|
|
*/ |
|
42
|
|
|
const DATABASE_NAME = 'Shop'; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* The table name for this class |
|
46
|
|
|
*/ |
|
47
|
|
|
const TABLE_NAME = 'page_link'; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* The related Propel class for this table |
|
51
|
|
|
*/ |
|
52
|
|
|
const OM_CLASS = '\\mod_link\\models\\PageLink'; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* A class that can be returned by this tableMap |
|
56
|
|
|
*/ |
|
57
|
|
|
const CLASS_DEFAULT = 'mod_link.models.PageLink'; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* The total number of columns |
|
61
|
|
|
*/ |
|
62
|
|
|
const NUM_COLUMNS = 6; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* The number of lazy-loaded columns |
|
66
|
|
|
*/ |
|
67
|
|
|
const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71
|
|
|
*/ |
|
72
|
|
|
const NUM_HYDRATE_COLUMNS = 6; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* the column name for the id field |
|
76
|
|
|
*/ |
|
77
|
|
|
const COL_ID = 'page_link.id'; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* the column name for the page_id field |
|
81
|
|
|
*/ |
|
82
|
|
|
const COL_PAGE_ID = 'page_link.page_id'; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* the column name for the active_from field |
|
86
|
|
|
*/ |
|
87
|
|
|
const COL_ACTIVE_FROM = 'page_link.active_from'; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* the column name for the active_to field |
|
91
|
|
|
*/ |
|
92
|
|
|
const COL_ACTIVE_TO = 'page_link.active_to'; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* the column name for the show_on field |
|
96
|
|
|
*/ |
|
97
|
|
|
const COL_SHOW_ON = 'page_link.show_on'; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* the column name for the permanent field |
|
101
|
|
|
*/ |
|
102
|
|
|
const COL_PERMANENT = 'page_link.permanent'; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* The default string format for model objects of the related table |
|
106
|
|
|
*/ |
|
107
|
|
|
const DEFAULT_STRING_FORMAT = 'YAML'; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* holds an array of fieldnames |
|
111
|
|
|
* |
|
112
|
|
|
* first dimension keys are the type constants |
|
|
|
|
|
|
113
|
|
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
114
|
|
|
*/ |
|
115
|
|
|
protected static $fieldNames = array ( |
|
|
|
|
|
|
116
|
|
|
self::TYPE_PHPNAME => array('Id', 'PageId', 'ActiveFrom', 'ActiveTo', 'ShowOn', 'Permanent', ), |
|
|
|
|
|
|
117
|
|
|
self::TYPE_CAMELNAME => array('id', 'pageId', 'activeFrom', 'activeTo', 'showOn', 'permanent', ), |
|
|
|
|
|
|
118
|
|
|
self::TYPE_COLNAME => array(PageLinkTableMap::COL_ID, PageLinkTableMap::COL_PAGE_ID, PageLinkTableMap::COL_ACTIVE_FROM, PageLinkTableMap::COL_ACTIVE_TO, PageLinkTableMap::COL_SHOW_ON, PageLinkTableMap::COL_PERMANENT, ), |
|
|
|
|
|
|
119
|
|
|
self::TYPE_FIELDNAME => array('id', 'page_id', 'active_from', 'active_to', 'show_on', 'permanent', ), |
|
|
|
|
|
|
120
|
|
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
|
|
|
|
|
121
|
|
|
); |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* holds an array of keys for quick access to the fieldnames array |
|
125
|
|
|
* |
|
126
|
|
|
* first dimension keys are the type constants |
|
|
|
|
|
|
127
|
|
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
128
|
|
|
*/ |
|
129
|
|
|
protected static $fieldKeys = array ( |
|
|
|
|
|
|
130
|
|
|
self::TYPE_PHPNAME => array('Id' => 0, 'PageId' => 1, 'ActiveFrom' => 2, 'ActiveTo' => 3, 'ShowOn' => 4, 'Permanent' => 5, ), |
|
|
|
|
|
|
131
|
|
|
self::TYPE_CAMELNAME => array('id' => 0, 'pageId' => 1, 'activeFrom' => 2, 'activeTo' => 3, 'showOn' => 4, 'permanent' => 5, ), |
|
|
|
|
|
|
132
|
|
|
self::TYPE_COLNAME => array(PageLinkTableMap::COL_ID => 0, PageLinkTableMap::COL_PAGE_ID => 1, PageLinkTableMap::COL_ACTIVE_FROM => 2, PageLinkTableMap::COL_ACTIVE_TO => 3, PageLinkTableMap::COL_SHOW_ON => 4, PageLinkTableMap::COL_PERMANENT => 5, ), |
|
|
|
|
|
|
133
|
|
|
self::TYPE_FIELDNAME => array('id' => 0, 'page_id' => 1, 'active_from' => 2, 'active_to' => 3, 'show_on' => 4, 'permanent' => 5, ), |
|
|
|
|
|
|
134
|
|
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
|
|
|
|
|
135
|
|
|
); |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* Initialize the table attributes and columns |
|
139
|
|
|
* Relations are not initialized by this method since they are lazy loaded |
|
140
|
|
|
* |
|
141
|
|
|
* @return void |
|
|
|
|
|
|
142
|
|
|
* @throws PropelException |
|
|
|
|
|
|
143
|
|
|
*/ |
|
144
|
|
View Code Duplication |
public function initialize() |
|
145
|
|
|
{ |
|
146
|
|
|
// attributes |
|
147
|
|
|
$this->setName('page_link'); |
|
148
|
|
|
$this->setPhpName('PageLink'); |
|
149
|
|
|
$this->setIdentifierQuoting(false); |
|
150
|
|
|
$this->setClassName('\\mod_link\\models\\PageLink'); |
|
151
|
|
|
$this->setPackage('mod_link.models'); |
|
152
|
|
|
$this->setUseIdGenerator(true); |
|
153
|
|
|
// columns |
|
154
|
|
|
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, 11, null); |
|
155
|
|
|
$this->addColumn('page_id', 'PageId', 'INTEGER', false, 11, null); |
|
156
|
|
|
$this->addColumn('active_from', 'ActiveFrom', 'INTEGER', false, 11, null); |
|
157
|
|
|
$this->addColumn('active_to', 'ActiveTo', 'INTEGER', false, 11, null); |
|
158
|
|
|
$this->addColumn('show_on', 'ShowOn', 'BOOLEAN', false, 1, null); |
|
159
|
|
|
$this->addColumn('permanent', 'Permanent', 'BOOLEAN', false, 1, null); |
|
160
|
|
|
} // initialize() |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Build the RelationMap objects for this table relationships |
|
164
|
|
|
*/ |
|
165
|
|
|
public function buildRelations() |
|
166
|
|
|
{ |
|
167
|
|
|
$this->addRelation('PageLinkProduct', '\\mod_link\\models\\PageLinkProduct', RelationMap::ONE_TO_MANY, array ( |
|
|
|
|
|
|
168
|
|
|
0 => |
|
169
|
|
|
array ( |
|
|
|
|
|
|
170
|
|
|
0 => ':link_id', |
|
171
|
|
|
1 => ':id', |
|
172
|
|
|
), |
|
173
|
|
|
), null, null, 'PageLinkProducts', false); |
|
|
|
|
|
|
174
|
|
|
} // buildRelations() |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
178
|
|
|
* |
|
179
|
|
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
180
|
|
|
* a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
181
|
|
|
* |
|
182
|
|
|
* @param array $row resultset row. |
|
|
|
|
|
|
183
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
|
|
184
|
|
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
185
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
|
|
|
|
|
186
|
|
|
* |
|
187
|
|
|
* @return string The primary key hash of the row |
|
188
|
|
|
*/ |
|
189
|
|
View Code Duplication |
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
190
|
|
|
{ |
|
191
|
|
|
// If the PK cannot be derived from the row, return NULL. |
|
192
|
|
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
193
|
|
|
return null; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* Retrieves the primary key from the DB resultset row |
|
201
|
|
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
202
|
|
|
* a multi-column primary key, an array of the primary key columns will be returned. |
|
203
|
|
|
* |
|
204
|
|
|
* @param array $row resultset row. |
|
|
|
|
|
|
205
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
|
|
206
|
|
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
207
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
|
|
|
|
|
208
|
|
|
* |
|
209
|
|
|
* @return mixed The primary key of the row |
|
|
|
|
|
|
210
|
|
|
*/ |
|
211
|
|
View Code Duplication |
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
212
|
|
|
{ |
|
213
|
|
|
return (int) $row[ |
|
|
|
|
|
|
214
|
|
|
$indexType == TableMap::TYPE_NUM |
|
215
|
|
|
? 0 + $offset |
|
216
|
|
|
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
217
|
|
|
]; |
|
|
|
|
|
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* The class that the tableMap will make instances of. |
|
222
|
|
|
* |
|
223
|
|
|
* If $withPrefix is true, the returned path |
|
224
|
|
|
* uses a dot-path notation which is translated into a path |
|
225
|
|
|
* relative to a location on the PHP include_path. |
|
226
|
|
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
227
|
|
|
* |
|
228
|
|
|
* @param boolean $withPrefix Whether or not to return the path with the class name |
|
229
|
|
|
* @return string path.to.ClassName |
|
230
|
|
|
*/ |
|
231
|
|
|
public static function getOMClass($withPrefix = true) |
|
232
|
|
|
{ |
|
233
|
|
|
return $withPrefix ? PageLinkTableMap::CLASS_DEFAULT : PageLinkTableMap::OM_CLASS; |
|
|
|
|
|
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* Populates an object of the default type or an object that inherit from the default. |
|
238
|
|
|
* |
|
239
|
|
|
* @param array $row row returned by DataFetcher->fetch(). |
|
|
|
|
|
|
240
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
|
|
241
|
|
|
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
242
|
|
|
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
243
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
244
|
|
|
* |
|
245
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
246
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
247
|
|
|
* @return array (PageLink object, last column rank) |
|
248
|
|
|
*/ |
|
249
|
|
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
250
|
|
|
{ |
|
251
|
|
|
$key = PageLinkTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
|
|
|
|
|
252
|
|
|
if (null !== ($obj = PageLinkTableMap::getInstanceFromPool($key))) { |
|
|
|
|
|
|
253
|
|
|
// We no longer rehydrate the object, since this can cause data loss. |
|
254
|
|
|
// See http://www.propelorm.org/ticket/509 |
|
255
|
|
|
// $obj->hydrate($row, $offset, true); // rehydrate |
|
256
|
|
|
$col = $offset + PageLinkTableMap::NUM_HYDRATE_COLUMNS; |
|
|
|
|
|
|
257
|
|
|
} else { |
|
258
|
|
|
$cls = PageLinkTableMap::OM_CLASS; |
|
|
|
|
|
|
259
|
|
|
/** @var PageLink $obj */ |
|
260
|
|
|
$obj = new $cls(); |
|
261
|
|
|
$col = $obj->hydrate($row, $offset, false, $indexType); |
|
262
|
|
|
PageLinkTableMap::addInstanceToPool($obj, $key); |
|
|
|
|
|
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
return array($obj, $col); |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* The returned array will contain objects of the default type or |
|
270
|
|
|
* objects that inherit from the default. |
|
271
|
|
|
* |
|
272
|
|
|
* @param DataFetcherInterface $dataFetcher |
|
273
|
|
|
* @return array |
|
274
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
275
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
276
|
|
|
*/ |
|
277
|
|
|
public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
278
|
|
|
{ |
|
279
|
|
|
$results = array(); |
|
280
|
|
|
|
|
281
|
|
|
// set the class once to avoid overhead in the loop |
|
282
|
|
|
$cls = static::getOMClass(false); |
|
283
|
|
|
// populate the object(s) |
|
284
|
|
|
while ($row = $dataFetcher->fetch()) { |
|
285
|
|
|
$key = PageLinkTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
|
|
|
|
|
286
|
|
|
if (null !== ($obj = PageLinkTableMap::getInstanceFromPool($key))) { |
|
|
|
|
|
|
287
|
|
|
// We no longer rehydrate the object, since this can cause data loss. |
|
288
|
|
|
// See http://www.propelorm.org/ticket/509 |
|
289
|
|
|
// $obj->hydrate($row, 0, true); // rehydrate |
|
290
|
|
|
$results[] = $obj; |
|
291
|
|
|
} else { |
|
292
|
|
|
/** @var PageLink $obj */ |
|
293
|
|
|
$obj = new $cls(); |
|
294
|
|
|
$obj->hydrate($row); |
|
295
|
|
|
$results[] = $obj; |
|
296
|
|
|
PageLinkTableMap::addInstanceToPool($obj, $key); |
|
|
|
|
|
|
297
|
|
|
} // if key exists |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
return $results; |
|
301
|
|
|
} |
|
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* Add all the columns needed to create a new object. |
|
304
|
|
|
* |
|
305
|
|
|
* Note: any columns that were marked with lazyLoad="true" in the |
|
306
|
|
|
* XML schema will not be added to the select list and only loaded |
|
307
|
|
|
* on demand. |
|
308
|
|
|
* |
|
309
|
|
|
* @param Criteria $criteria object containing the columns to add. |
|
310
|
|
|
* @param string $alias optional table alias |
|
|
|
|
|
|
311
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
312
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
313
|
|
|
*/ |
|
314
|
|
|
public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
315
|
|
|
{ |
|
316
|
|
|
if (null === $alias) { |
|
317
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_ID); |
|
|
|
|
|
|
318
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_PAGE_ID); |
|
|
|
|
|
|
319
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_ACTIVE_FROM); |
|
|
|
|
|
|
320
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_ACTIVE_TO); |
|
|
|
|
|
|
321
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_SHOW_ON); |
|
|
|
|
|
|
322
|
|
|
$criteria->addSelectColumn(PageLinkTableMap::COL_PERMANENT); |
|
|
|
|
|
|
323
|
|
|
} else { |
|
324
|
|
|
$criteria->addSelectColumn($alias . '.id'); |
|
325
|
|
|
$criteria->addSelectColumn($alias . '.page_id'); |
|
326
|
|
|
$criteria->addSelectColumn($alias . '.active_from'); |
|
327
|
|
|
$criteria->addSelectColumn($alias . '.active_to'); |
|
328
|
|
|
$criteria->addSelectColumn($alias . '.show_on'); |
|
329
|
|
|
$criteria->addSelectColumn($alias . '.permanent'); |
|
330
|
|
|
} |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
/** |
|
334
|
|
|
* Returns the TableMap related to this object. |
|
335
|
|
|
* This method is not needed for general use but a specific application could have a need. |
|
336
|
|
|
* @return TableMap |
|
337
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
338
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
339
|
|
|
*/ |
|
340
|
|
|
public static function getTableMap() |
|
341
|
|
|
{ |
|
342
|
|
|
return Propel::getServiceContainer()->getDatabaseMap(PageLinkTableMap::DATABASE_NAME)->getTable(PageLinkTableMap::TABLE_NAME); |
|
|
|
|
|
|
343
|
|
|
} |
|
344
|
|
|
|
|
345
|
|
|
/** |
|
346
|
|
|
* Add a TableMap instance to the database for this tableMap class. |
|
347
|
|
|
*/ |
|
348
|
|
|
public static function buildTableMap() |
|
349
|
|
|
{ |
|
350
|
|
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PageLinkTableMap::DATABASE_NAME); |
|
|
|
|
|
|
351
|
|
|
if (!$dbMap->hasTable(PageLinkTableMap::TABLE_NAME)) { |
|
|
|
|
|
|
352
|
|
|
$dbMap->addTableObject(new PageLinkTableMap()); |
|
353
|
|
|
} |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
/** |
|
357
|
|
|
* Performs a DELETE on the database, given a PageLink or Criteria object OR a primary key value. |
|
358
|
|
|
* |
|
359
|
|
|
* @param mixed $values Criteria or PageLink object or primary key or array of primary keys |
|
|
|
|
|
|
360
|
|
|
* which is used to create the DELETE statement |
|
|
|
|
|
|
361
|
|
|
* @param ConnectionInterface $con the connection to use |
|
362
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
363
|
|
|
* if supported by native driver or if emulated using Propel. |
|
364
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
365
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
366
|
|
|
*/ |
|
367
|
|
|
public static function doDelete($values, ConnectionInterface $con = null) |
|
368
|
|
|
{ |
|
369
|
|
|
if (null === $con) { |
|
370
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkTableMap::DATABASE_NAME); |
|
|
|
|
|
|
371
|
|
|
} |
|
372
|
|
|
|
|
373
|
|
|
if ($values instanceof Criteria) { |
|
374
|
|
|
// rename for clarity |
|
375
|
|
|
$criteria = $values; |
|
376
|
|
|
} elseif ($values instanceof \mod_link\models\PageLink) { // it's a model object |
|
|
|
|
|
|
377
|
|
|
// create criteria based on pk values |
|
378
|
|
|
$criteria = $values->buildPkeyCriteria(); |
|
379
|
|
|
} else { // it's a primary key, or an array of pks |
|
|
|
|
|
|
380
|
|
|
$criteria = new Criteria(PageLinkTableMap::DATABASE_NAME); |
|
|
|
|
|
|
381
|
|
|
$criteria->add(PageLinkTableMap::COL_ID, (array) $values, Criteria::IN); |
|
|
|
|
|
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
$query = PageLinkQuery::create()->mergeWith($criteria); |
|
385
|
|
|
|
|
386
|
|
|
if ($values instanceof Criteria) { |
|
387
|
|
|
PageLinkTableMap::clearInstancePool(); |
|
|
|
|
|
|
388
|
|
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
|
|
|
|
|
389
|
|
|
foreach ((array) $values as $singleval) { |
|
390
|
|
|
PageLinkTableMap::removeInstanceFromPool($singleval); |
|
|
|
|
|
|
391
|
|
|
} |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
return $query->delete($con); |
|
395
|
|
|
} |
|
|
|
|
|
|
396
|
|
|
|
|
397
|
|
|
/** |
|
398
|
|
|
* Deletes all rows from the page_link table. |
|
399
|
|
|
* |
|
400
|
|
|
* @param ConnectionInterface $con the connection to use |
|
401
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
|
402
|
|
|
*/ |
|
403
|
|
|
public static function doDeleteAll(ConnectionInterface $con = null) |
|
404
|
|
|
{ |
|
405
|
|
|
return PageLinkQuery::create()->doDeleteAll($con); |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
/** |
|
409
|
|
|
* Performs an INSERT on the database, given a PageLink or Criteria object. |
|
410
|
|
|
* |
|
411
|
|
|
* @param mixed $criteria Criteria or PageLink object containing data that is used to create the INSERT statement. |
|
|
|
|
|
|
412
|
|
|
* @param ConnectionInterface $con the ConnectionInterface connection to use |
|
413
|
|
|
* @return mixed The new primary key. |
|
414
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
|
415
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
|
|
416
|
|
|
*/ |
|
417
|
|
View Code Duplication |
public static function doInsert($criteria, ConnectionInterface $con = null) |
|
418
|
|
|
{ |
|
419
|
|
|
if (null === $con) { |
|
420
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkTableMap::DATABASE_NAME); |
|
|
|
|
|
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
if ($criteria instanceof Criteria) { |
|
424
|
|
|
$criteria = clone $criteria; // rename for clarity |
|
425
|
|
|
} else { |
|
426
|
|
|
$criteria = $criteria->buildCriteria(); // build Criteria from PageLink object |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
if ($criteria->containsKey(PageLinkTableMap::COL_ID) && $criteria->keyContainsValue(PageLinkTableMap::COL_ID) ) { |
|
|
|
|
|
|
430
|
|
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.PageLinkTableMap::COL_ID.')'); |
|
|
|
|
|
|
431
|
|
|
} |
|
432
|
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
434
|
|
|
// Set the correct dbName |
|
435
|
|
|
$query = PageLinkQuery::create()->mergeWith($criteria); |
|
436
|
|
|
|
|
437
|
|
|
// use transaction because $criteria could contain info |
|
438
|
|
|
// for more than one table (I guess, conceivably) |
|
439
|
|
|
return $con->transaction(function () use ($con, $query) { |
|
440
|
|
|
return $query->doInsert($con); |
|
441
|
|
|
}); |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
} // PageLinkTableMap |
|
445
|
|
|
// This is the static code needed to register the TableMap for this table with the main Propel class. |
|
446
|
|
|
// |
|
447
|
|
|
PageLinkTableMap::buildTableMap(); |
|
|
|
|
|
|
448
|
|
|
|