1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace mod_link\models\Base; |
4
|
|
|
|
5
|
|
|
use \Exception; |
6
|
|
|
use \PDO; |
7
|
|
|
use Propel\Runtime\Propel; |
8
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
9
|
|
|
use Propel\Runtime\ActiveQuery\ModelCriteria; |
10
|
|
|
use Propel\Runtime\ActiveQuery\ModelJoin; |
11
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
12
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
13
|
|
|
use Propel\Runtime\Exception\PropelException; |
14
|
|
|
use mod_link\models\PageLinkProduct as ChildPageLinkProduct; |
15
|
|
|
use mod_link\models\PageLinkProductQuery as ChildPageLinkProductQuery; |
16
|
|
|
use mod_link\models\Map\PageLinkProductTableMap; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Base class that represents a query for the 'page_link_product' table. |
20
|
|
|
* |
21
|
|
|
* |
22
|
|
|
* |
23
|
|
|
* @method ChildPageLinkProductQuery orderByLinkId($order = Criteria::ASC) Order by the link_id column |
24
|
|
|
* @method ChildPageLinkProductQuery orderByProductId($order = Criteria::ASC) Order by the product_id column |
25
|
|
|
* |
26
|
|
|
* @method ChildPageLinkProductQuery groupByLinkId() Group by the link_id column |
27
|
|
|
* @method ChildPageLinkProductQuery groupByProductId() Group by the product_id column |
28
|
|
|
* |
29
|
|
|
* @method ChildPageLinkProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query |
30
|
|
|
* @method ChildPageLinkProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query |
31
|
|
|
* @method ChildPageLinkProductQuery innerJoin($relation) Adds a INNER JOIN clause to the query |
32
|
|
|
* |
33
|
|
|
* @method ChildPageLinkProductQuery leftJoinWith($relation) Adds a LEFT JOIN clause and with to the query |
34
|
|
|
* @method ChildPageLinkProductQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query |
35
|
|
|
* @method ChildPageLinkProductQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query |
36
|
|
|
* |
37
|
|
|
* @method ChildPageLinkProductQuery leftJoinPageLink($relationAlias = null) Adds a LEFT JOIN clause to the query using the PageLink relation |
38
|
|
|
* @method ChildPageLinkProductQuery rightJoinPageLink($relationAlias = null) Adds a RIGHT JOIN clause to the query using the PageLink relation |
39
|
|
|
* @method ChildPageLinkProductQuery innerJoinPageLink($relationAlias = null) Adds a INNER JOIN clause to the query using the PageLink relation |
40
|
|
|
* |
41
|
|
|
* @method ChildPageLinkProductQuery joinWithPageLink($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the PageLink relation |
42
|
|
|
* |
43
|
|
|
* @method ChildPageLinkProductQuery leftJoinWithPageLink() Adds a LEFT JOIN clause and with to the query using the PageLink relation |
44
|
|
|
* @method ChildPageLinkProductQuery rightJoinWithPageLink() Adds a RIGHT JOIN clause and with to the query using the PageLink relation |
45
|
|
|
* @method ChildPageLinkProductQuery innerJoinWithPageLink() Adds a INNER JOIN clause and with to the query using the PageLink relation |
46
|
|
|
* |
47
|
|
|
* @method \mod_link\models\PageLinkQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria |
48
|
|
|
* |
49
|
|
|
* @method ChildPageLinkProduct findOne(ConnectionInterface $con = null) Return the first ChildPageLinkProduct matching the query |
50
|
|
|
* @method ChildPageLinkProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildPageLinkProduct matching the query, or a new ChildPageLinkProduct object populated from the query conditions when no match is found |
51
|
|
|
* |
52
|
|
|
* @method ChildPageLinkProduct findOneByLinkId(int $link_id) Return the first ChildPageLinkProduct filtered by the link_id column |
53
|
|
|
* @method ChildPageLinkProduct findOneByProductId(int $product_id) Return the first ChildPageLinkProduct filtered by the product_id column * |
54
|
|
|
|
55
|
|
|
* @method ChildPageLinkProduct requirePk($key, ConnectionInterface $con = null) Return the ChildPageLinkProduct by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
56
|
|
|
* @method ChildPageLinkProduct requireOne(ConnectionInterface $con = null) Return the first ChildPageLinkProduct matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
57
|
|
|
* |
58
|
|
|
* @method ChildPageLinkProduct requireOneByLinkId(int $link_id) Return the first ChildPageLinkProduct filtered by the link_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
59
|
|
|
* @method ChildPageLinkProduct requireOneByProductId(int $product_id) Return the first ChildPageLinkProduct filtered by the product_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
60
|
|
|
* |
61
|
|
|
* @method ChildPageLinkProduct[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildPageLinkProduct objects based on current ModelCriteria |
62
|
|
|
* @method ChildPageLinkProduct[]|ObjectCollection findByLinkId(int $link_id) Return ChildPageLinkProduct objects filtered by the link_id column |
63
|
|
|
* @method ChildPageLinkProduct[]|ObjectCollection findByProductId(int $product_id) Return ChildPageLinkProduct objects filtered by the product_id column |
64
|
|
|
* @method ChildPageLinkProduct[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit |
65
|
|
|
* |
66
|
|
|
*/ |
|
|
|
|
67
|
|
View Code Duplication |
abstract class PageLinkProductQuery extends ModelCriteria |
|
|
|
|
68
|
|
|
{ |
|
|
|
|
69
|
|
|
protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Initializes internal state of \mod_link\models\Base\PageLinkProductQuery object. |
73
|
|
|
* |
74
|
|
|
* @param string $dbName The database name |
75
|
|
|
* @param string $modelName The phpName of a model, e.g. 'Book' |
76
|
|
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b' |
77
|
|
|
*/ |
78
|
|
|
public function __construct($dbName = 'Shop', $modelName = '\\mod_link\\models\\PageLinkProduct', $modelAlias = null) |
79
|
|
|
{ |
80
|
|
|
parent::__construct($dbName, $modelName, $modelAlias); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Returns a new ChildPageLinkProductQuery object. |
85
|
|
|
* |
86
|
|
|
* @param string $modelAlias The alias of a model in the query |
87
|
|
|
* @param Criteria $criteria Optional Criteria to build the query from |
88
|
|
|
* |
89
|
|
|
* @return ChildPageLinkProductQuery |
90
|
|
|
*/ |
91
|
|
|
public static function create($modelAlias = null, Criteria $criteria = null) |
92
|
|
|
{ |
93
|
|
|
if ($criteria instanceof ChildPageLinkProductQuery) { |
94
|
|
|
return $criteria; |
95
|
|
|
} |
96
|
|
|
$query = new ChildPageLinkProductQuery(); |
97
|
|
|
if (null !== $modelAlias) { |
98
|
|
|
$query->setModelAlias($modelAlias); |
99
|
|
|
} |
100
|
|
|
if ($criteria instanceof Criteria) { |
101
|
|
|
$query->mergeWith($criteria); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
return $query; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Find object by primary key. |
109
|
|
|
* Propel uses the instance pool to skip the database if the object exists. |
110
|
|
|
* Go fast if the query is untouched. |
111
|
|
|
* |
112
|
|
|
* <code> |
|
|
|
|
113
|
|
|
* $obj = $c->findPk(array(12, 34), $con); |
114
|
|
|
* </code> |
115
|
|
|
* |
116
|
|
|
* @param array[$link_id, $product_id] $key Primary key to use for the query |
|
|
|
|
117
|
|
|
* @param ConnectionInterface $con an optional connection object |
118
|
|
|
* |
119
|
|
|
* @return ChildPageLinkProduct|array|mixed the result, formatted by the current formatter |
120
|
|
|
*/ |
121
|
|
|
public function findPk($key, ConnectionInterface $con = null) |
122
|
|
|
{ |
123
|
|
|
if ($key === null) { |
124
|
|
|
return null; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
if ($con === null) { |
128
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(PageLinkProductTableMap::DATABASE_NAME); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
$this->basePreSelect($con); |
132
|
|
|
|
133
|
|
|
if ( |
|
|
|
|
134
|
|
|
$this->formatter || $this->modelAlias || $this->with || $this->select |
|
|
|
|
135
|
|
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers |
136
|
|
|
|| $this->map || $this->having || $this->joins |
137
|
|
|
) { |
138
|
|
|
return $this->findPkComplex($key, $con); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
if ((null !== ($obj = PageLinkProductTableMap::getInstanceFromPool(serialize([(null === $key[0] || is_scalar($key[0]) || is_callable([$key[0], '__toString']) ? (string) $key[0] : $key[0]), (null === $key[1] || is_scalar($key[1]) || is_callable([$key[1], '__toString']) ? (string) $key[1] : $key[1])]))))) { |
142
|
|
|
// the object is already in the instance pool |
143
|
|
|
return $obj; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
return $this->findPkSimple($key, $con); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Find object by primary key using raw SQL to go fast. |
151
|
|
|
* Bypass doSelect() and the object formatter by using generated code. |
152
|
|
|
* |
153
|
|
|
* @param mixed $key Primary key to use for the query |
154
|
|
|
* @param ConnectionInterface $con A connection object |
155
|
|
|
* |
156
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
157
|
|
|
* |
158
|
|
|
* @return ChildPageLinkProduct A model object, or null if the key is not found |
|
|
|
|
159
|
|
|
*/ |
160
|
|
|
protected function findPkSimple($key, ConnectionInterface $con) |
161
|
|
|
{ |
162
|
|
|
$sql = 'SELECT link_id, product_id FROM page_link_product WHERE link_id = :p0 AND product_id = :p1'; |
163
|
|
|
try { |
164
|
|
|
$stmt = $con->prepare($sql); |
165
|
|
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); |
166
|
|
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT); |
167
|
|
|
$stmt->execute(); |
168
|
|
|
} catch (Exception $e) { |
169
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
170
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
171
|
|
|
} |
172
|
|
|
$obj = null; |
173
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
174
|
|
|
/** @var ChildPageLinkProduct $obj */ |
175
|
|
|
$obj = new ChildPageLinkProduct(); |
176
|
|
|
$obj->hydrate($row); |
177
|
|
|
PageLinkProductTableMap::addInstanceToPool($obj, serialize([(null === $key[0] || is_scalar($key[0]) || is_callable([$key[0], '__toString']) ? (string) $key[0] : $key[0]), (null === $key[1] || is_scalar($key[1]) || is_callable([$key[1], '__toString']) ? (string) $key[1] : $key[1])])); |
178
|
|
|
} |
179
|
|
|
$stmt->closeCursor(); |
180
|
|
|
|
181
|
|
|
return $obj; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Find object by primary key. |
186
|
|
|
* |
187
|
|
|
* @param mixed $key Primary key to use for the query |
188
|
|
|
* @param ConnectionInterface $con A connection object |
189
|
|
|
* |
190
|
|
|
* @return ChildPageLinkProduct|array|mixed the result, formatted by the current formatter |
191
|
|
|
*/ |
192
|
|
|
protected function findPkComplex($key, ConnectionInterface $con) |
193
|
|
|
{ |
194
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
195
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
196
|
|
|
$dataFetcher = $criteria |
197
|
|
|
->filterByPrimaryKey($key) |
198
|
|
|
->doSelect($con); |
199
|
|
|
|
200
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Find objects by primary key |
205
|
|
|
* <code> |
206
|
|
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); |
207
|
|
|
* </code> |
208
|
|
|
* @param array $keys Primary keys to use for the query |
209
|
|
|
* @param ConnectionInterface $con an optional connection object |
210
|
|
|
* |
211
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
212
|
|
|
*/ |
213
|
|
|
public function findPks($keys, ConnectionInterface $con = null) |
214
|
|
|
{ |
215
|
|
|
if (null === $con) { |
216
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
217
|
|
|
} |
218
|
|
|
$this->basePreSelect($con); |
219
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
220
|
|
|
$dataFetcher = $criteria |
221
|
|
|
->filterByPrimaryKeys($keys) |
222
|
|
|
->doSelect($con); |
223
|
|
|
|
224
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Filter the query by primary key |
229
|
|
|
* |
230
|
|
|
* @param mixed $key Primary key to use for the query |
231
|
|
|
* |
232
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
233
|
|
|
*/ |
234
|
|
|
public function filterByPrimaryKey($key) |
235
|
|
|
{ |
236
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $key[0], Criteria::EQUAL); |
237
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_PRODUCT_ID, $key[1], Criteria::EQUAL); |
238
|
|
|
|
239
|
|
|
return $this; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Filter the query by a list of primary keys |
244
|
|
|
* |
245
|
|
|
* @param array $keys The list of primary key to use for the query |
246
|
|
|
* |
247
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
248
|
|
|
*/ |
249
|
|
|
public function filterByPrimaryKeys($keys) |
250
|
|
|
{ |
251
|
|
|
if (empty($keys)) { |
252
|
|
|
return $this->add(null, '1<>1', Criteria::CUSTOM); |
253
|
|
|
} |
254
|
|
|
foreach ($keys as $key) { |
255
|
|
|
$cton0 = $this->getNewCriterion(PageLinkProductTableMap::COL_LINK_ID, $key[0], Criteria::EQUAL); |
256
|
|
|
$cton1 = $this->getNewCriterion(PageLinkProductTableMap::COL_PRODUCT_ID, $key[1], Criteria::EQUAL); |
257
|
|
|
$cton0->addAnd($cton1); |
258
|
|
|
$this->addOr($cton0); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
return $this; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* Filter the query on the link_id column |
266
|
|
|
* |
267
|
|
|
* Example usage: |
268
|
|
|
* <code> |
269
|
|
|
* $query->filterByLinkId(1234); // WHERE link_id = 1234 |
270
|
|
|
* $query->filterByLinkId(array(12, 34)); // WHERE link_id IN (12, 34) |
271
|
|
|
* $query->filterByLinkId(array('min' => 12)); // WHERE link_id > 12 |
272
|
|
|
* </code> |
273
|
|
|
* |
274
|
|
|
* @see filterByPageLink() |
275
|
|
|
* |
276
|
|
|
* @param mixed $linkId The value to use as filter. |
|
|
|
|
277
|
|
|
* Use scalar values for equality. |
278
|
|
|
* Use array values for in_array() equivalent. |
279
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
280
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
281
|
|
|
* |
282
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
283
|
|
|
*/ |
284
|
|
|
public function filterByLinkId($linkId = null, $comparison = null) |
285
|
|
|
{ |
286
|
|
|
if (is_array($linkId)) { |
287
|
|
|
$useMinMax = false; |
288
|
|
|
if (isset($linkId['min'])) { |
289
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $linkId['min'], Criteria::GREATER_EQUAL); |
290
|
|
|
$useMinMax = true; |
291
|
|
|
} |
292
|
|
|
if (isset($linkId['max'])) { |
293
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $linkId['max'], Criteria::LESS_EQUAL); |
294
|
|
|
$useMinMax = true; |
295
|
|
|
} |
296
|
|
|
if ($useMinMax) { |
297
|
|
|
return $this; |
298
|
|
|
} |
299
|
|
|
if (null === $comparison) { |
300
|
|
|
$comparison = Criteria::IN; |
301
|
|
|
} |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
return $this->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $linkId, $comparison); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Filter the query on the product_id column |
309
|
|
|
* |
310
|
|
|
* Example usage: |
311
|
|
|
* <code> |
312
|
|
|
* $query->filterByProductId(1234); // WHERE product_id = 1234 |
313
|
|
|
* $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34) |
314
|
|
|
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12 |
315
|
|
|
* </code> |
316
|
|
|
* |
317
|
|
|
* @param mixed $productId The value to use as filter. |
318
|
|
|
* Use scalar values for equality. |
319
|
|
|
* Use array values for in_array() equivalent. |
320
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
321
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
322
|
|
|
* |
323
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
324
|
|
|
*/ |
325
|
|
|
public function filterByProductId($productId = null, $comparison = null) |
326
|
|
|
{ |
327
|
|
|
if (is_array($productId)) { |
328
|
|
|
$useMinMax = false; |
329
|
|
|
if (isset($productId['min'])) { |
330
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); |
331
|
|
|
$useMinMax = true; |
332
|
|
|
} |
333
|
|
|
if (isset($productId['max'])) { |
334
|
|
|
$this->addUsingAlias(PageLinkProductTableMap::COL_PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); |
335
|
|
|
$useMinMax = true; |
336
|
|
|
} |
337
|
|
|
if ($useMinMax) { |
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
if (null === $comparison) { |
341
|
|
|
$comparison = Criteria::IN; |
342
|
|
|
} |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
return $this->addUsingAlias(PageLinkProductTableMap::COL_PRODUCT_ID, $productId, $comparison); |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Filter the query by a related \mod_link\models\PageLink object |
350
|
|
|
* |
351
|
|
|
* @param \mod_link\models\PageLink|ObjectCollection $pageLink The related object(s) to use as filter |
352
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
353
|
|
|
* |
354
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
355
|
|
|
* |
356
|
|
|
* @return ChildPageLinkProductQuery The current query, for fluid interface |
357
|
|
|
*/ |
358
|
|
|
public function filterByPageLink($pageLink, $comparison = null) |
359
|
|
|
{ |
360
|
|
|
if ($pageLink instanceof \mod_link\models\PageLink) { |
361
|
|
|
return $this |
362
|
|
|
->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $pageLink->getId(), $comparison); |
363
|
|
|
} elseif ($pageLink instanceof ObjectCollection) { |
364
|
|
|
if (null === $comparison) { |
365
|
|
|
$comparison = Criteria::IN; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
return $this |
369
|
|
|
->addUsingAlias(PageLinkProductTableMap::COL_LINK_ID, $pageLink->toKeyValue('PrimaryKey', 'Id'), $comparison); |
370
|
|
|
} else { |
371
|
|
|
throw new PropelException('filterByPageLink() only accepts arguments of type \mod_link\models\PageLink or Collection'); |
372
|
|
|
} |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Adds a JOIN clause to the query using the PageLink relation |
377
|
|
|
* |
378
|
|
|
* @param string $relationAlias optional alias for the relation |
379
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
380
|
|
|
* |
381
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
382
|
|
|
*/ |
383
|
|
|
public function joinPageLink($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
384
|
|
|
{ |
385
|
|
|
$tableMap = $this->getTableMap(); |
386
|
|
|
$relationMap = $tableMap->getRelation('PageLink'); |
387
|
|
|
|
388
|
|
|
// create a ModelJoin object for this join |
389
|
|
|
$join = new ModelJoin(); |
390
|
|
|
$join->setJoinType($joinType); |
391
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
392
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
393
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
// add the ModelJoin to the current object |
397
|
|
|
if ($relationAlias) { |
398
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
399
|
|
|
$this->addJoinObject($join, $relationAlias); |
400
|
|
|
} else { |
401
|
|
|
$this->addJoinObject($join, 'PageLink'); |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
return $this; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Use the PageLink relation PageLink object |
409
|
|
|
* |
410
|
|
|
* @see useQuery() |
411
|
|
|
* |
412
|
|
|
* @param string $relationAlias optional alias for the relation, |
|
|
|
|
413
|
|
|
* to be used as main alias in the secondary query |
|
|
|
|
414
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
415
|
|
|
* |
416
|
|
|
* @return \mod_link\models\PageLinkQuery A secondary query class using the current class as primary query |
417
|
|
|
*/ |
418
|
|
|
public function usePageLinkQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
419
|
|
|
{ |
420
|
|
|
return $this |
421
|
|
|
->joinPageLink($relationAlias, $joinType) |
422
|
|
|
->useQuery($relationAlias ? $relationAlias : 'PageLink', '\mod_link\models\PageLinkQuery'); |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Exclude object from result |
427
|
|
|
* |
428
|
|
|
* @param ChildPageLinkProduct $pageLinkProduct Object to remove from the list of results |
429
|
|
|
* |
430
|
|
|
* @return $this|ChildPageLinkProductQuery The current query, for fluid interface |
|
|
|
|
431
|
|
|
*/ |
432
|
|
|
public function prune($pageLinkProduct = null) |
433
|
|
|
{ |
434
|
|
|
if ($pageLinkProduct) { |
435
|
|
|
$this->addCond('pruneCond0', $this->getAliasedColName(PageLinkProductTableMap::COL_LINK_ID), $pageLinkProduct->getLinkId(), Criteria::NOT_EQUAL); |
436
|
|
|
$this->addCond('pruneCond1', $this->getAliasedColName(PageLinkProductTableMap::COL_PRODUCT_ID), $pageLinkProduct->getProductId(), Criteria::NOT_EQUAL); |
437
|
|
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
return $this; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* Deletes all rows from the page_link_product table. |
445
|
|
|
* |
446
|
|
|
* @param ConnectionInterface $con the connection to use |
447
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
448
|
|
|
*/ |
449
|
|
|
public function doDeleteAll(ConnectionInterface $con = null) |
450
|
|
|
{ |
451
|
|
|
if (null === $con) { |
452
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductTableMap::DATABASE_NAME); |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
// use transaction because $criteria could contain info |
456
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
457
|
|
|
return $con->transaction(function () use ($con) { |
458
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
459
|
|
|
$affectedRows += parent::doDeleteAll($con); |
460
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
461
|
|
|
// clear the cached instance *after* the emulation has happened (since |
462
|
|
|
// instances get re-added by the select statement contained therein). |
463
|
|
|
PageLinkProductTableMap::clearInstancePool(); |
464
|
|
|
PageLinkProductTableMap::clearRelatedInstancePool(); |
465
|
|
|
|
466
|
|
|
return $affectedRows; |
467
|
|
|
}); |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
/** |
471
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
472
|
|
|
* |
473
|
|
|
* @param ConnectionInterface $con the connection to use |
474
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
475
|
|
|
* if supported by native driver or if emulated using Propel. |
476
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
477
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
478
|
|
|
*/ |
479
|
|
|
public function delete(ConnectionInterface $con = null) |
480
|
|
|
{ |
481
|
|
|
if (null === $con) { |
482
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductTableMap::DATABASE_NAME); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
$criteria = $this; |
486
|
|
|
|
487
|
|
|
// Set the correct dbName |
488
|
|
|
$criteria->setDbName(PageLinkProductTableMap::DATABASE_NAME); |
489
|
|
|
|
490
|
|
|
// use transaction because $criteria could contain info |
491
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
492
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
493
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
494
|
|
|
|
495
|
|
|
PageLinkProductTableMap::removeInstanceFromPool($criteria); |
496
|
|
|
|
497
|
|
|
$affectedRows += ModelCriteria::delete($con); |
498
|
|
|
PageLinkProductTableMap::clearRelatedInstancePool(); |
499
|
|
|
|
500
|
|
|
return $affectedRows; |
501
|
|
|
}); |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
} // PageLinkProductQuery |
|
|
|
|
505
|
|
|
|