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\PageLinkProduct; |
15
|
|
|
use mod_link\models\PageLinkProductQuery; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* This class defines the structure of the 'page_link_product' 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
|
|
View Code Duplication |
class PageLinkProductTableMap 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.PageLinkProductTableMap'; |
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_product'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* The related Propel class for this table |
51
|
|
|
*/ |
52
|
|
|
const OM_CLASS = '\\mod_link\\models\\PageLinkProduct'; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* A class that can be returned by this tableMap |
56
|
|
|
*/ |
57
|
|
|
const CLASS_DEFAULT = 'mod_link.models.PageLinkProduct'; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The total number of columns |
61
|
|
|
*/ |
62
|
|
|
const NUM_COLUMNS = 2; |
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 = 2; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* the column name for the link_id field |
76
|
|
|
*/ |
77
|
|
|
const COL_LINK_ID = 'page_link_product.link_id'; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* the column name for the product_id field |
81
|
|
|
*/ |
82
|
|
|
const COL_PRODUCT_ID = 'page_link_product.product_id'; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* The default string format for model objects of the related table |
86
|
|
|
*/ |
87
|
|
|
const DEFAULT_STRING_FORMAT = 'YAML'; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* holds an array of fieldnames |
91
|
|
|
* |
92
|
|
|
* first dimension keys are the type constants |
|
|
|
|
93
|
|
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
94
|
|
|
*/ |
95
|
|
|
protected static $fieldNames = array ( |
|
|
|
|
96
|
|
|
self::TYPE_PHPNAME => array('LinkId', 'ProductId', ), |
|
|
|
|
97
|
|
|
self::TYPE_CAMELNAME => array('linkId', 'productId', ), |
|
|
|
|
98
|
|
|
self::TYPE_COLNAME => array(PageLinkProductTableMap::COL_LINK_ID, PageLinkProductTableMap::COL_PRODUCT_ID, ), |
|
|
|
|
99
|
|
|
self::TYPE_FIELDNAME => array('link_id', 'product_id', ), |
|
|
|
|
100
|
|
|
self::TYPE_NUM => array(0, 1, ) |
|
|
|
|
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* holds an array of keys for quick access to the fieldnames array |
105
|
|
|
* |
106
|
|
|
* first dimension keys are the type constants |
|
|
|
|
107
|
|
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
108
|
|
|
*/ |
109
|
|
|
protected static $fieldKeys = array ( |
|
|
|
|
110
|
|
|
self::TYPE_PHPNAME => array('LinkId' => 0, 'ProductId' => 1, ), |
|
|
|
|
111
|
|
|
self::TYPE_CAMELNAME => array('linkId' => 0, 'productId' => 1, ), |
|
|
|
|
112
|
|
|
self::TYPE_COLNAME => array(PageLinkProductTableMap::COL_LINK_ID => 0, PageLinkProductTableMap::COL_PRODUCT_ID => 1, ), |
|
|
|
|
113
|
|
|
self::TYPE_FIELDNAME => array('link_id' => 0, 'product_id' => 1, ), |
|
|
|
|
114
|
|
|
self::TYPE_NUM => array(0, 1, ) |
|
|
|
|
115
|
|
|
); |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Initialize the table attributes and columns |
119
|
|
|
* Relations are not initialized by this method since they are lazy loaded |
120
|
|
|
* |
121
|
|
|
* @return void |
|
|
|
|
122
|
|
|
* @throws PropelException |
|
|
|
|
123
|
|
|
*/ |
124
|
|
|
public function initialize() |
125
|
|
|
{ |
126
|
|
|
// attributes |
127
|
|
|
$this->setName('page_link_product'); |
128
|
|
|
$this->setPhpName('PageLinkProduct'); |
129
|
|
|
$this->setIdentifierQuoting(false); |
130
|
|
|
$this->setClassName('\\mod_link\\models\\PageLinkProduct'); |
131
|
|
|
$this->setPackage('mod_link.models'); |
132
|
|
|
$this->setUseIdGenerator(false); |
133
|
|
|
$this->setIsCrossRef(true); |
134
|
|
|
// columns |
135
|
|
|
$this->addForeignPrimaryKey('link_id', 'LinkId', 'INTEGER' , 'page_link', 'id', true, null, null); |
|
|
|
|
136
|
|
|
$this->addPrimaryKey('product_id', 'ProductId', 'INTEGER', true, null, null); |
137
|
|
|
} // initialize() |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Build the RelationMap objects for this table relationships |
141
|
|
|
*/ |
142
|
|
|
public function buildRelations() |
143
|
|
|
{ |
144
|
|
|
$this->addRelation('PageLink', '\\mod_link\\models\\PageLink', RelationMap::MANY_TO_ONE, array ( |
|
|
|
|
145
|
|
|
0 => |
146
|
|
|
array ( |
|
|
|
|
147
|
|
|
0 => ':link_id', |
148
|
|
|
1 => ':id', |
149
|
|
|
), |
150
|
|
|
), null, null, null, false); |
|
|
|
|
151
|
|
|
} // buildRelations() |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Adds an object to the instance pool. |
155
|
|
|
* |
156
|
|
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved |
157
|
|
|
* from the database. In some cases you may need to explicitly add objects |
158
|
|
|
* to the cache in order to ensure that the same objects are always returned by find*() |
159
|
|
|
* and findPk*() calls. |
160
|
|
|
* |
161
|
|
|
* @param \mod_link\models\PageLinkProduct $obj A \mod_link\models\PageLinkProduct object. |
162
|
|
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). |
163
|
|
|
*/ |
164
|
|
|
public static function addInstanceToPool($obj, $key = null) |
165
|
|
|
{ |
166
|
|
|
if (Propel::isInstancePoolingEnabled()) { |
167
|
|
|
if (null === $key) { |
168
|
|
|
$key = serialize([(null === $obj->getLinkId() || is_scalar($obj->getLinkId()) || is_callable([$obj->getLinkId(), '__toString']) ? (string) $obj->getLinkId() : $obj->getLinkId()), (null === $obj->getProductId() || is_scalar($obj->getProductId()) || is_callable([$obj->getProductId(), '__toString']) ? (string) $obj->getProductId() : $obj->getProductId())]); |
169
|
|
|
} // if key === null |
170
|
|
|
self::$instances[$key] = $obj; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Removes an object from the instance pool. |
176
|
|
|
* |
177
|
|
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved |
178
|
|
|
* from the database. In some cases -- especially when you override doDelete |
179
|
|
|
* methods in your stub classes -- you may need to explicitly remove objects |
180
|
|
|
* from the cache in order to prevent returning objects that no longer exist. |
181
|
|
|
* |
182
|
|
|
* @param mixed $value A \mod_link\models\PageLinkProduct object or a primary key value. |
183
|
|
|
*/ |
184
|
|
|
public static function removeInstanceFromPool($value) |
185
|
|
|
{ |
186
|
|
|
if (Propel::isInstancePoolingEnabled() && null !== $value) { |
187
|
|
|
if (is_object($value) && $value instanceof \mod_link\models\PageLinkProduct) { |
188
|
|
|
$key = serialize([(null === $value->getLinkId() || is_scalar($value->getLinkId()) || is_callable([$value->getLinkId(), '__toString']) ? (string) $value->getLinkId() : $value->getLinkId()), (null === $value->getProductId() || is_scalar($value->getProductId()) || is_callable([$value->getProductId(), '__toString']) ? (string) $value->getProductId() : $value->getProductId())]); |
189
|
|
|
|
190
|
|
|
} elseif (is_array($value) && count($value) === 2) { |
191
|
|
|
// assume we've been passed a primary key"; |
192
|
|
|
$key = serialize([(null === $value[0] || is_scalar($value[0]) || is_callable([$value[0], '__toString']) ? (string) $value[0] : $value[0]), (null === $value[1] || is_scalar($value[1]) || is_callable([$value[1], '__toString']) ? (string) $value[1] : $value[1])]); |
193
|
|
|
} elseif ($value instanceof Criteria) { |
194
|
|
|
self::$instances = []; |
195
|
|
|
|
196
|
|
|
return; |
197
|
|
|
} else { |
198
|
|
|
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \mod_link\models\PageLinkProduct object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); |
199
|
|
|
throw $e; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
unset(self::$instances[$key]); |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* 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. |
208
|
|
|
* |
209
|
|
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
210
|
|
|
* a multi-column primary key, a serialize()d version of the primary key will be returned. |
211
|
|
|
* |
212
|
|
|
* @param array $row resultset row. |
|
|
|
|
213
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
214
|
|
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
215
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
|
|
|
216
|
|
|
* |
217
|
|
|
* @return string The primary key hash of the row |
|
|
|
|
218
|
|
|
*/ |
219
|
|
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
220
|
|
|
{ |
221
|
|
|
// If the PK cannot be derived from the row, return NULL. |
222
|
|
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
223
|
|
|
return null; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
return serialize([(null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)]), (null === $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)])]); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* Retrieves the primary key from the DB resultset row |
231
|
|
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
232
|
|
|
* a multi-column primary key, an array of the primary key columns will be returned. |
233
|
|
|
* |
234
|
|
|
* @param array $row resultset row. |
|
|
|
|
235
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
236
|
|
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
237
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
|
|
|
238
|
|
|
* |
239
|
|
|
* @return mixed The primary key of the row |
|
|
|
|
240
|
|
|
*/ |
241
|
|
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
242
|
|
|
{ |
243
|
|
|
$pks = []; |
244
|
|
|
|
245
|
|
|
$pks[] = (int) $row[ |
|
|
|
|
246
|
|
|
$indexType == TableMap::TYPE_NUM |
247
|
|
|
? 0 + $offset |
248
|
|
|
: self::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType) |
249
|
|
|
]; |
|
|
|
|
250
|
|
|
$pks[] = (int) $row[ |
|
|
|
|
251
|
|
|
$indexType == TableMap::TYPE_NUM |
252
|
|
|
? 1 + $offset |
253
|
|
|
: self::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType) |
254
|
|
|
]; |
|
|
|
|
255
|
|
|
|
256
|
|
|
return $pks; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* The class that the tableMap will make instances of. |
261
|
|
|
* |
262
|
|
|
* If $withPrefix is true, the returned path |
263
|
|
|
* uses a dot-path notation which is translated into a path |
264
|
|
|
* relative to a location on the PHP include_path. |
265
|
|
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
266
|
|
|
* |
267
|
|
|
* @param boolean $withPrefix Whether or not to return the path with the class name |
268
|
|
|
* @return string path.to.ClassName |
269
|
|
|
*/ |
270
|
|
|
public static function getOMClass($withPrefix = true) |
271
|
|
|
{ |
272
|
|
|
return $withPrefix ? PageLinkProductTableMap::CLASS_DEFAULT : PageLinkProductTableMap::OM_CLASS; |
|
|
|
|
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Populates an object of the default type or an object that inherit from the default. |
277
|
|
|
* |
278
|
|
|
* @param array $row row returned by DataFetcher->fetch(). |
|
|
|
|
279
|
|
|
* @param int $offset The 0-based offset for reading from the resultset row. |
|
|
|
|
280
|
|
|
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
281
|
|
|
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
282
|
|
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
283
|
|
|
* |
284
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
285
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
286
|
|
|
* @return array (PageLinkProduct object, last column rank) |
287
|
|
|
*/ |
288
|
|
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
289
|
|
|
{ |
290
|
|
|
$key = PageLinkProductTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
|
|
|
291
|
|
|
if (null !== ($obj = PageLinkProductTableMap::getInstanceFromPool($key))) { |
|
|
|
|
292
|
|
|
// We no longer rehydrate the object, since this can cause data loss. |
293
|
|
|
// See http://www.propelorm.org/ticket/509 |
294
|
|
|
// $obj->hydrate($row, $offset, true); // rehydrate |
295
|
|
|
$col = $offset + PageLinkProductTableMap::NUM_HYDRATE_COLUMNS; |
|
|
|
|
296
|
|
|
} else { |
297
|
|
|
$cls = PageLinkProductTableMap::OM_CLASS; |
|
|
|
|
298
|
|
|
/** @var PageLinkProduct $obj */ |
299
|
|
|
$obj = new $cls(); |
300
|
|
|
$col = $obj->hydrate($row, $offset, false, $indexType); |
301
|
|
|
PageLinkProductTableMap::addInstanceToPool($obj, $key); |
|
|
|
|
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
return array($obj, $col); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* The returned array will contain objects of the default type or |
309
|
|
|
* objects that inherit from the default. |
310
|
|
|
* |
311
|
|
|
* @param DataFetcherInterface $dataFetcher |
312
|
|
|
* @return array |
313
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
314
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
315
|
|
|
*/ |
316
|
|
|
public static function populateObjects(DataFetcherInterface $dataFetcher) |
317
|
|
|
{ |
318
|
|
|
$results = array(); |
319
|
|
|
|
320
|
|
|
// set the class once to avoid overhead in the loop |
321
|
|
|
$cls = static::getOMClass(false); |
322
|
|
|
// populate the object(s) |
323
|
|
|
while ($row = $dataFetcher->fetch()) { |
324
|
|
|
$key = PageLinkProductTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
|
|
|
325
|
|
|
if (null !== ($obj = PageLinkProductTableMap::getInstanceFromPool($key))) { |
|
|
|
|
326
|
|
|
// We no longer rehydrate the object, since this can cause data loss. |
327
|
|
|
// See http://www.propelorm.org/ticket/509 |
328
|
|
|
// $obj->hydrate($row, 0, true); // rehydrate |
329
|
|
|
$results[] = $obj; |
330
|
|
|
} else { |
331
|
|
|
/** @var PageLinkProduct $obj */ |
332
|
|
|
$obj = new $cls(); |
333
|
|
|
$obj->hydrate($row); |
334
|
|
|
$results[] = $obj; |
335
|
|
|
PageLinkProductTableMap::addInstanceToPool($obj, $key); |
|
|
|
|
336
|
|
|
} // if key exists |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
return $results; |
340
|
|
|
} |
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Add all the columns needed to create a new object. |
343
|
|
|
* |
344
|
|
|
* Note: any columns that were marked with lazyLoad="true" in the |
345
|
|
|
* XML schema will not be added to the select list and only loaded |
346
|
|
|
* on demand. |
347
|
|
|
* |
348
|
|
|
* @param Criteria $criteria object containing the columns to add. |
349
|
|
|
* @param string $alias optional table alias |
|
|
|
|
350
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
351
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
352
|
|
|
*/ |
353
|
|
|
public static function addSelectColumns(Criteria $criteria, $alias = null) |
354
|
|
|
{ |
355
|
|
|
if (null === $alias) { |
356
|
|
|
$criteria->addSelectColumn(PageLinkProductTableMap::COL_LINK_ID); |
|
|
|
|
357
|
|
|
$criteria->addSelectColumn(PageLinkProductTableMap::COL_PRODUCT_ID); |
|
|
|
|
358
|
|
|
} else { |
359
|
|
|
$criteria->addSelectColumn($alias . '.link_id'); |
360
|
|
|
$criteria->addSelectColumn($alias . '.product_id'); |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Returns the TableMap related to this object. |
366
|
|
|
* This method is not needed for general use but a specific application could have a need. |
367
|
|
|
* @return TableMap |
368
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
369
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
370
|
|
|
*/ |
371
|
|
|
public static function getTableMap() |
372
|
|
|
{ |
373
|
|
|
return Propel::getServiceContainer()->getDatabaseMap(PageLinkProductTableMap::DATABASE_NAME)->getTable(PageLinkProductTableMap::TABLE_NAME); |
|
|
|
|
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* Add a TableMap instance to the database for this tableMap class. |
378
|
|
|
*/ |
379
|
|
|
public static function buildTableMap() |
380
|
|
|
{ |
381
|
|
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(PageLinkProductTableMap::DATABASE_NAME); |
|
|
|
|
382
|
|
|
if (!$dbMap->hasTable(PageLinkProductTableMap::TABLE_NAME)) { |
|
|
|
|
383
|
|
|
$dbMap->addTableObject(new PageLinkProductTableMap()); |
384
|
|
|
} |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* Performs a DELETE on the database, given a PageLinkProduct or Criteria object OR a primary key value. |
389
|
|
|
* |
390
|
|
|
* @param mixed $values Criteria or PageLinkProduct object or primary key or array of primary keys |
|
|
|
|
391
|
|
|
* which is used to create the DELETE statement |
|
|
|
|
392
|
|
|
* @param ConnectionInterface $con the connection to use |
393
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
394
|
|
|
* if supported by native driver or if emulated using Propel. |
395
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
396
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
397
|
|
|
*/ |
398
|
|
|
public static function doDelete($values, ConnectionInterface $con = null) |
399
|
|
|
{ |
400
|
|
|
if (null === $con) { |
401
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductTableMap::DATABASE_NAME); |
|
|
|
|
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
if ($values instanceof Criteria) { |
405
|
|
|
// rename for clarity |
406
|
|
|
$criteria = $values; |
407
|
|
|
} elseif ($values instanceof \mod_link\models\PageLinkProduct) { // it's a model object |
|
|
|
|
408
|
|
|
// create criteria based on pk values |
409
|
|
|
$criteria = $values->buildPkeyCriteria(); |
410
|
|
|
} else { // it's a primary key, or an array of pks |
|
|
|
|
411
|
|
|
$criteria = new Criteria(PageLinkProductTableMap::DATABASE_NAME); |
|
|
|
|
412
|
|
|
// primary key is composite; we therefore, expect |
413
|
|
|
// the primary key passed to be an array of pkey values |
414
|
|
|
if (count($values) == count($values, COUNT_RECURSIVE)) { |
415
|
|
|
// array is not multi-dimensional |
416
|
|
|
$values = array($values); |
417
|
|
|
} |
418
|
|
|
foreach ($values as $value) { |
419
|
|
|
$criterion = $criteria->getNewCriterion(PageLinkProductTableMap::COL_LINK_ID, $value[0]); |
|
|
|
|
420
|
|
|
$criterion->addAnd($criteria->getNewCriterion(PageLinkProductTableMap::COL_PRODUCT_ID, $value[1])); |
|
|
|
|
421
|
|
|
$criteria->addOr($criterion); |
422
|
|
|
} |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
$query = PageLinkProductQuery::create()->mergeWith($criteria); |
426
|
|
|
|
427
|
|
|
if ($values instanceof Criteria) { |
428
|
|
|
PageLinkProductTableMap::clearInstancePool(); |
|
|
|
|
429
|
|
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
|
|
|
430
|
|
|
foreach ((array) $values as $singleval) { |
431
|
|
|
PageLinkProductTableMap::removeInstanceFromPool($singleval); |
|
|
|
|
432
|
|
|
} |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
return $query->delete($con); |
436
|
|
|
} |
|
|
|
|
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Deletes all rows from the page_link_product table. |
440
|
|
|
* |
441
|
|
|
* @param ConnectionInterface $con the connection to use |
442
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
443
|
|
|
*/ |
444
|
|
|
public static function doDeleteAll(ConnectionInterface $con = null) |
445
|
|
|
{ |
446
|
|
|
return PageLinkProductQuery::create()->doDeleteAll($con); |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* Performs an INSERT on the database, given a PageLinkProduct or Criteria object. |
451
|
|
|
* |
452
|
|
|
* @param mixed $criteria Criteria or PageLinkProduct object containing data that is used to create the INSERT statement. |
|
|
|
|
453
|
|
|
* @param ConnectionInterface $con the ConnectionInterface connection to use |
454
|
|
|
* @return mixed The new primary key. |
455
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
456
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
457
|
|
|
*/ |
458
|
|
|
public static function doInsert($criteria, ConnectionInterface $con = null) |
459
|
|
|
{ |
460
|
|
|
if (null === $con) { |
461
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductTableMap::DATABASE_NAME); |
|
|
|
|
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
if ($criteria instanceof Criteria) { |
465
|
|
|
$criteria = clone $criteria; // rename for clarity |
466
|
|
|
} else { |
467
|
|
|
$criteria = $criteria->buildCriteria(); // build Criteria from PageLinkProduct object |
468
|
|
|
} |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
471
|
|
|
// Set the correct dbName |
472
|
|
|
$query = PageLinkProductQuery::create()->mergeWith($criteria); |
473
|
|
|
|
474
|
|
|
// use transaction because $criteria could contain info |
475
|
|
|
// for more than one table (I guess, conceivably) |
476
|
|
|
return $con->transaction(function () use ($con, $query) { |
477
|
|
|
return $query->doInsert($con); |
478
|
|
|
}); |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
} // PageLinkProductTableMap |
482
|
|
|
// This is the static code needed to register the TableMap for this table with the main Propel class. |
483
|
|
|
// |
484
|
|
|
PageLinkProductTableMap::buildTableMap(); |
|
|
|
|
485
|
|
|
|