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