These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace xbanners\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 xbanners\models\BannerImage; |
||
15 | use xbanners\models\BannerImageQuery; |
||
16 | |||
17 | |||
18 | /** |
||
19 | * This class defines the structure of the 'banner_image' 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 BannerImageTableMap extends TableMap |
||
30 | { |
||
31 | use InstancePoolTrait; |
||
32 | use TableMapTrait; |
||
33 | |||
34 | /** |
||
35 | * The (dot-path) name of this class |
||
36 | */ |
||
37 | const CLASS_NAME = 'xbanners.models.Map.BannerImageTableMap'; |
||
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 = 'banner_image'; |
||
48 | |||
49 | /** |
||
50 | * The related Propel class for this table |
||
51 | */ |
||
52 | const OM_CLASS = '\\xbanners\\models\\BannerImage'; |
||
53 | |||
54 | /** |
||
55 | * A class that can be returned by this tableMap |
||
56 | */ |
||
57 | const CLASS_DEFAULT = 'xbanners.models.BannerImage'; |
||
58 | |||
59 | /** |
||
60 | * The total number of columns |
||
61 | */ |
||
62 | const NUM_COLUMNS = 10; |
||
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 = 10; |
||
73 | |||
74 | /** |
||
75 | * the column name for the id field |
||
76 | */ |
||
77 | const COL_ID = 'banner_image.id'; |
||
78 | |||
79 | /** |
||
80 | * the column name for the banner_id field |
||
81 | */ |
||
82 | const COL_BANNER_ID = 'banner_image.banner_id'; |
||
83 | |||
84 | /** |
||
85 | * the column name for the target field |
||
86 | */ |
||
87 | const COL_TARGET = 'banner_image.target'; |
||
88 | |||
89 | /** |
||
90 | * the column name for the url field |
||
91 | */ |
||
92 | const COL_URL = 'banner_image.url'; |
||
93 | |||
94 | /** |
||
95 | * the column name for the allowed_page field |
||
96 | */ |
||
97 | const COL_ALLOWED_PAGE = 'banner_image.allowed_page'; |
||
98 | |||
99 | /** |
||
100 | * the column name for the position field |
||
101 | */ |
||
102 | const COL_POSITION = 'banner_image.position'; |
||
103 | |||
104 | /** |
||
105 | * the column name for the active_from field |
||
106 | */ |
||
107 | const COL_ACTIVE_FROM = 'banner_image.active_from'; |
||
108 | |||
109 | /** |
||
110 | * the column name for the active_to field |
||
111 | */ |
||
112 | const COL_ACTIVE_TO = 'banner_image.active_to'; |
||
113 | |||
114 | /** |
||
115 | * the column name for the active field |
||
116 | */ |
||
117 | const COL_ACTIVE = 'banner_image.active'; |
||
118 | |||
119 | /** |
||
120 | * the column name for the permanent field |
||
121 | */ |
||
122 | const COL_PERMANENT = 'banner_image.permanent'; |
||
123 | |||
124 | /** |
||
125 | * The default string format for model objects of the related table |
||
126 | */ |
||
127 | const DEFAULT_STRING_FORMAT = 'YAML'; |
||
128 | |||
129 | // i18n behavior |
||
130 | |||
131 | /** |
||
132 | * The default locale to use for translations. |
||
133 | * |
||
134 | * @var string |
||
135 | */ |
||
136 | const DEFAULT_LOCALE = 'ru'; |
||
137 | |||
138 | /** |
||
139 | * holds an array of fieldnames |
||
140 | * |
||
141 | * first dimension keys are the type constants |
||
142 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
||
143 | */ |
||
144 | protected static $fieldNames = array ( |
||
145 | self::TYPE_PHPNAME => array('Id', 'BannerId', 'Target', 'Url', 'AllowedPage', 'Position', 'ActiveFrom', 'ActiveTo', 'Active', 'Permanent', ), |
||
146 | self::TYPE_CAMELNAME => array('id', 'bannerId', 'target', 'url', 'allowedPage', 'position', 'activeFrom', 'activeTo', 'active', 'permanent', ), |
||
147 | self::TYPE_COLNAME => array(BannerImageTableMap::COL_ID, BannerImageTableMap::COL_BANNER_ID, BannerImageTableMap::COL_TARGET, BannerImageTableMap::COL_URL, BannerImageTableMap::COL_ALLOWED_PAGE, BannerImageTableMap::COL_POSITION, BannerImageTableMap::COL_ACTIVE_FROM, BannerImageTableMap::COL_ACTIVE_TO, BannerImageTableMap::COL_ACTIVE, BannerImageTableMap::COL_PERMANENT, ), |
||
148 | self::TYPE_FIELDNAME => array('id', 'banner_id', 'target', 'url', 'allowed_page', 'position', 'active_from', 'active_to', 'active', 'permanent', ), |
||
149 | self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
||
150 | ); |
||
151 | |||
152 | /** |
||
153 | * holds an array of keys for quick access to the fieldnames array |
||
154 | * |
||
155 | * first dimension keys are the type constants |
||
156 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
||
157 | */ |
||
158 | protected static $fieldKeys = array ( |
||
159 | self::TYPE_PHPNAME => array('Id' => 0, 'BannerId' => 1, 'Target' => 2, 'Url' => 3, 'AllowedPage' => 4, 'Position' => 5, 'ActiveFrom' => 6, 'ActiveTo' => 7, 'Active' => 8, 'Permanent' => 9, ), |
||
160 | self::TYPE_CAMELNAME => array('id' => 0, 'bannerId' => 1, 'target' => 2, 'url' => 3, 'allowedPage' => 4, 'position' => 5, 'activeFrom' => 6, 'activeTo' => 7, 'active' => 8, 'permanent' => 9, ), |
||
161 | self::TYPE_COLNAME => array(BannerImageTableMap::COL_ID => 0, BannerImageTableMap::COL_BANNER_ID => 1, BannerImageTableMap::COL_TARGET => 2, BannerImageTableMap::COL_URL => 3, BannerImageTableMap::COL_ALLOWED_PAGE => 4, BannerImageTableMap::COL_POSITION => 5, BannerImageTableMap::COL_ACTIVE_FROM => 6, BannerImageTableMap::COL_ACTIVE_TO => 7, BannerImageTableMap::COL_ACTIVE => 8, BannerImageTableMap::COL_PERMANENT => 9, ), |
||
162 | self::TYPE_FIELDNAME => array('id' => 0, 'banner_id' => 1, 'target' => 2, 'url' => 3, 'allowed_page' => 4, 'position' => 5, 'active_from' => 6, 'active_to' => 7, 'active' => 8, 'permanent' => 9, ), |
||
163 | self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
||
164 | ); |
||
165 | |||
166 | /** |
||
167 | * Initialize the table attributes and columns |
||
168 | * Relations are not initialized by this method since they are lazy loaded |
||
169 | * |
||
170 | * @return void |
||
171 | * @throws PropelException |
||
172 | */ |
||
173 | public function initialize() |
||
174 | { |
||
175 | // attributes |
||
176 | $this->setName('banner_image'); |
||
177 | $this->setPhpName('BannerImage'); |
||
178 | $this->setIdentifierQuoting(false); |
||
179 | $this->setClassName('\\xbanners\\models\\BannerImage'); |
||
180 | $this->setPackage('xbanners.models'); |
||
181 | $this->setUseIdGenerator(true); |
||
182 | // columns |
||
183 | $this->addPrimaryKey('id', 'Id', 'INTEGER', true, 11, null); |
||
184 | $this->addForeignKey('banner_id', 'BannerId', 'INTEGER', 'banners', 'id', true, 11, null); |
||
185 | $this->addColumn('target', 'Target', 'INTEGER', false, 2, null); |
||
186 | $this->addColumn('url', 'Url', 'VARCHAR', false, 255, null); |
||
187 | $this->addColumn('allowed_page', 'AllowedPage', 'INTEGER', false, 11, null); |
||
188 | $this->addColumn('position', 'Position', 'INTEGER', false, 11, null); |
||
189 | $this->addColumn('active_from', 'ActiveFrom', 'INTEGER', false, 11, null); |
||
190 | $this->addColumn('active_to', 'ActiveTo', 'INTEGER', false, 11, null); |
||
191 | $this->addColumn('active', 'Active', 'INTEGER', false, 1, null); |
||
192 | $this->addColumn('permanent', 'Permanent', 'INTEGER', false, 1, null); |
||
193 | } // initialize() |
||
194 | |||
195 | /** |
||
196 | * Build the RelationMap objects for this table relationships |
||
197 | */ |
||
198 | View Code Duplication | public function buildRelations() |
|
199 | { |
||
200 | $this->addRelation('Banners', '\\xbanners\\models\\Banners', RelationMap::MANY_TO_ONE, array ( |
||
201 | 0 => |
||
202 | array ( |
||
203 | 0 => ':banner_id', |
||
204 | 1 => ':id', |
||
205 | ), |
||
206 | ), 'CASCADE', 'CASCADE', null, false); |
||
207 | $this->addRelation('BannerImageI18n', '\\xbanners\\models\\BannerImageI18n', RelationMap::ONE_TO_MANY, array ( |
||
208 | 0 => |
||
209 | array ( |
||
210 | 0 => ':id', |
||
211 | 1 => ':id', |
||
212 | ), |
||
213 | ), 'CASCADE', null, 'BannerImageI18ns', false); |
||
214 | } // buildRelations() |
||
215 | |||
216 | /** |
||
217 | * |
||
218 | * Gets the list of behaviors registered for this table |
||
219 | * |
||
220 | * @return array Associative array (name => parameters) of behaviors |
||
221 | */ |
||
222 | public function getBehaviors() |
||
223 | { |
||
224 | return array( |
||
225 | 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'src, name, clicks, description', 'i18n_pk_column' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => 'ru', 'locale_alias' => '', ), |
||
226 | ); |
||
227 | } // getBehaviors() |
||
228 | /** |
||
229 | * Method to invalidate the instance pool of all tables related to banner_image * by a foreign key with ON DELETE CASCADE |
||
230 | */ |
||
231 | public static function clearRelatedInstancePool() |
||
232 | { |
||
233 | // Invalidate objects in related instance pools, |
||
234 | // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. |
||
235 | BannerImageI18nTableMap::clearInstancePool(); |
||
236 | } |
||
237 | |||
238 | /** |
||
239 | * 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. |
||
240 | * |
||
241 | * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
||
242 | * a multi-column primary key, a serialize()d version of the primary key will be returned. |
||
243 | * |
||
244 | * @param array $row resultset row. |
||
245 | * @param int $offset The 0-based offset for reading from the resultset row. |
||
246 | * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
247 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
||
248 | * |
||
249 | * @return string The primary key hash of the row |
||
250 | */ |
||
251 | View Code Duplication | public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
252 | { |
||
253 | // If the PK cannot be derived from the row, return NULL. |
||
254 | if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
||
255 | return null; |
||
256 | } |
||
257 | |||
258 | 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)]; |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * Retrieves the primary key from the DB resultset row |
||
263 | * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
||
264 | * a multi-column primary key, an array of the primary key columns will be returned. |
||
265 | * |
||
266 | * @param array $row resultset row. |
||
267 | * @param int $offset The 0-based offset for reading from the resultset row. |
||
268 | * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
269 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
||
270 | * |
||
271 | * @return mixed The primary key of the row |
||
272 | */ |
||
273 | View Code Duplication | public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
274 | { |
||
275 | return (int) $row[ |
||
276 | $indexType == TableMap::TYPE_NUM |
||
277 | ? 0 + $offset |
||
278 | : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
||
279 | ]; |
||
280 | } |
||
281 | |||
282 | /** |
||
283 | * The class that the tableMap will make instances of. |
||
284 | * |
||
285 | * If $withPrefix is true, the returned path |
||
286 | * uses a dot-path notation which is translated into a path |
||
287 | * relative to a location on the PHP include_path. |
||
288 | * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
||
289 | * |
||
290 | * @param boolean $withPrefix Whether or not to return the path with the class name |
||
291 | * @return string path.to.ClassName |
||
292 | */ |
||
293 | public static function getOMClass($withPrefix = true) |
||
294 | { |
||
295 | return $withPrefix ? BannerImageTableMap::CLASS_DEFAULT : BannerImageTableMap::OM_CLASS; |
||
296 | } |
||
297 | |||
298 | /** |
||
299 | * Populates an object of the default type or an object that inherit from the default. |
||
300 | * |
||
301 | * @param array $row row returned by DataFetcher->fetch(). |
||
302 | * @param int $offset The 0-based offset for reading from the resultset row. |
||
303 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
304 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
305 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
306 | * |
||
307 | * @throws PropelException Any exceptions caught during processing will be |
||
308 | * rethrown wrapped into a PropelException. |
||
309 | * @return array (BannerImage object, last column rank) |
||
310 | */ |
||
311 | public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
||
312 | { |
||
313 | $key = BannerImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
||
314 | if (null !== ($obj = BannerImageTableMap::getInstanceFromPool($key))) { |
||
315 | // We no longer rehydrate the object, since this can cause data loss. |
||
316 | // See http://www.propelorm.org/ticket/509 |
||
317 | // $obj->hydrate($row, $offset, true); // rehydrate |
||
318 | $col = $offset + BannerImageTableMap::NUM_HYDRATE_COLUMNS; |
||
319 | } else { |
||
320 | $cls = BannerImageTableMap::OM_CLASS; |
||
321 | /** @var BannerImage $obj */ |
||
322 | $obj = new $cls(); |
||
323 | $col = $obj->hydrate($row, $offset, false, $indexType); |
||
324 | BannerImageTableMap::addInstanceToPool($obj, $key); |
||
325 | } |
||
326 | |||
327 | return array($obj, $col); |
||
328 | } |
||
329 | |||
330 | /** |
||
331 | * The returned array will contain objects of the default type or |
||
332 | * objects that inherit from the default. |
||
333 | * |
||
334 | * @param DataFetcherInterface $dataFetcher |
||
335 | * @return array |
||
336 | * @throws PropelException Any exceptions caught during processing will be |
||
337 | * rethrown wrapped into a PropelException. |
||
338 | */ |
||
339 | public static function populateObjects(DataFetcherInterface $dataFetcher) |
||
340 | { |
||
341 | $results = array(); |
||
342 | |||
343 | // set the class once to avoid overhead in the loop |
||
344 | $cls = static::getOMClass(false); |
||
345 | // populate the object(s) |
||
346 | while ($row = $dataFetcher->fetch()) { |
||
347 | $key = BannerImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
||
348 | if (null !== ($obj = BannerImageTableMap::getInstanceFromPool($key))) { |
||
349 | // We no longer rehydrate the object, since this can cause data loss. |
||
350 | // See http://www.propelorm.org/ticket/509 |
||
351 | // $obj->hydrate($row, 0, true); // rehydrate |
||
352 | $results[] = $obj; |
||
353 | } else { |
||
354 | /** @var BannerImage $obj */ |
||
355 | $obj = new $cls(); |
||
356 | $obj->hydrate($row); |
||
357 | $results[] = $obj; |
||
358 | BannerImageTableMap::addInstanceToPool($obj, $key); |
||
359 | } // if key exists |
||
360 | } |
||
361 | |||
362 | return $results; |
||
363 | } |
||
364 | /** |
||
365 | * Add all the columns needed to create a new object. |
||
366 | * |
||
367 | * Note: any columns that were marked with lazyLoad="true" in the |
||
368 | * XML schema will not be added to the select list and only loaded |
||
369 | * on demand. |
||
370 | * |
||
371 | * @param Criteria $criteria object containing the columns to add. |
||
372 | * @param string $alias optional table alias |
||
373 | * @throws PropelException Any exceptions caught during processing will be |
||
374 | * rethrown wrapped into a PropelException. |
||
375 | */ |
||
376 | public static function addSelectColumns(Criteria $criteria, $alias = null) |
||
377 | { |
||
378 | if (null === $alias) { |
||
379 | $criteria->addSelectColumn(BannerImageTableMap::COL_ID); |
||
380 | $criteria->addSelectColumn(BannerImageTableMap::COL_BANNER_ID); |
||
381 | $criteria->addSelectColumn(BannerImageTableMap::COL_TARGET); |
||
382 | $criteria->addSelectColumn(BannerImageTableMap::COL_URL); |
||
383 | $criteria->addSelectColumn(BannerImageTableMap::COL_ALLOWED_PAGE); |
||
384 | $criteria->addSelectColumn(BannerImageTableMap::COL_POSITION); |
||
385 | $criteria->addSelectColumn(BannerImageTableMap::COL_ACTIVE_FROM); |
||
386 | $criteria->addSelectColumn(BannerImageTableMap::COL_ACTIVE_TO); |
||
387 | $criteria->addSelectColumn(BannerImageTableMap::COL_ACTIVE); |
||
388 | $criteria->addSelectColumn(BannerImageTableMap::COL_PERMANENT); |
||
389 | } else { |
||
390 | $criteria->addSelectColumn($alias . '.id'); |
||
391 | $criteria->addSelectColumn($alias . '.banner_id'); |
||
392 | $criteria->addSelectColumn($alias . '.target'); |
||
393 | $criteria->addSelectColumn($alias . '.url'); |
||
394 | $criteria->addSelectColumn($alias . '.allowed_page'); |
||
395 | $criteria->addSelectColumn($alias . '.position'); |
||
396 | $criteria->addSelectColumn($alias . '.active_from'); |
||
397 | $criteria->addSelectColumn($alias . '.active_to'); |
||
398 | $criteria->addSelectColumn($alias . '.active'); |
||
399 | $criteria->addSelectColumn($alias . '.permanent'); |
||
400 | } |
||
401 | } |
||
402 | |||
403 | /** |
||
404 | * Returns the TableMap related to this object. |
||
405 | * This method is not needed for general use but a specific application could have a need. |
||
406 | * @return TableMap |
||
407 | * @throws PropelException Any exceptions caught during processing will be |
||
408 | * rethrown wrapped into a PropelException. |
||
409 | */ |
||
410 | public static function getTableMap() |
||
411 | { |
||
412 | return Propel::getServiceContainer()->getDatabaseMap(BannerImageTableMap::DATABASE_NAME)->getTable(BannerImageTableMap::TABLE_NAME); |
||
413 | } |
||
414 | |||
415 | /** |
||
416 | * Add a TableMap instance to the database for this tableMap class. |
||
417 | */ |
||
418 | View Code Duplication | public static function buildTableMap() |
|
419 | { |
||
420 | $dbMap = Propel::getServiceContainer()->getDatabaseMap(BannerImageTableMap::DATABASE_NAME); |
||
421 | if (!$dbMap->hasTable(BannerImageTableMap::TABLE_NAME)) { |
||
422 | $dbMap->addTableObject(new BannerImageTableMap()); |
||
423 | } |
||
424 | } |
||
425 | |||
426 | /** |
||
427 | * Performs a DELETE on the database, given a BannerImage or Criteria object OR a primary key value. |
||
428 | * |
||
429 | * @param mixed $values Criteria or BannerImage object or primary key or array of primary keys |
||
430 | * which is used to create the DELETE statement |
||
431 | * @param ConnectionInterface $con the connection to use |
||
432 | * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
||
433 | * if supported by native driver or if emulated using Propel. |
||
434 | * @throws PropelException Any exceptions caught during processing will be |
||
435 | * rethrown wrapped into a PropelException. |
||
436 | */ |
||
437 | View Code Duplication | public static function doDelete($values, ConnectionInterface $con = null) |
|
438 | { |
||
439 | if (null === $con) { |
||
440 | $con = Propel::getServiceContainer()->getWriteConnection(BannerImageTableMap::DATABASE_NAME); |
||
441 | } |
||
442 | |||
443 | if ($values instanceof Criteria) { |
||
0 ignored issues
–
show
|
|||
444 | // rename for clarity |
||
445 | $criteria = $values; |
||
446 | } elseif ($values instanceof \xbanners\models\BannerImage) { // it's a model object |
||
447 | // create criteria based on pk values |
||
448 | $criteria = $values->buildPkeyCriteria(); |
||
449 | } else { // it's a primary key, or an array of pks |
||
450 | $criteria = new Criteria(BannerImageTableMap::DATABASE_NAME); |
||
451 | $criteria->add(BannerImageTableMap::COL_ID, (array) $values, Criteria::IN); |
||
452 | } |
||
453 | |||
454 | $query = BannerImageQuery::create()->mergeWith($criteria); |
||
455 | |||
456 | if ($values instanceof Criteria) { |
||
0 ignored issues
–
show
The class
Propel\Runtime\ActiveQuery\Criteria does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed.
Loading history...
|
|||
457 | BannerImageTableMap::clearInstancePool(); |
||
458 | } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
||
459 | foreach ((array) $values as $singleval) { |
||
460 | BannerImageTableMap::removeInstanceFromPool($singleval); |
||
461 | } |
||
462 | } |
||
463 | |||
464 | return $query->delete($con); |
||
465 | } |
||
466 | |||
467 | /** |
||
468 | * Deletes all rows from the banner_image table. |
||
469 | * |
||
470 | * @param ConnectionInterface $con the connection to use |
||
471 | * @return int The number of affected rows (if supported by underlying database driver). |
||
472 | */ |
||
473 | public static function doDeleteAll(ConnectionInterface $con = null) |
||
474 | { |
||
475 | return BannerImageQuery::create()->doDeleteAll($con); |
||
476 | } |
||
477 | |||
478 | /** |
||
479 | * Performs an INSERT on the database, given a BannerImage or Criteria object. |
||
480 | * |
||
481 | * @param mixed $criteria Criteria or BannerImage object containing data that is used to create the INSERT statement. |
||
482 | * @param ConnectionInterface $con the ConnectionInterface connection to use |
||
483 | * @return mixed The new primary key. |
||
484 | * @throws PropelException Any exceptions caught during processing will be |
||
485 | * rethrown wrapped into a PropelException. |
||
486 | */ |
||
487 | View Code Duplication | public static function doInsert($criteria, ConnectionInterface $con = null) |
|
488 | { |
||
489 | if (null === $con) { |
||
490 | $con = Propel::getServiceContainer()->getWriteConnection(BannerImageTableMap::DATABASE_NAME); |
||
491 | } |
||
492 | |||
493 | if ($criteria instanceof Criteria) { |
||
0 ignored issues
–
show
The class
Propel\Runtime\ActiveQuery\Criteria does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed.
Loading history...
|
|||
494 | $criteria = clone $criteria; // rename for clarity |
||
495 | } else { |
||
496 | $criteria = $criteria->buildCriteria(); // build Criteria from BannerImage object |
||
497 | } |
||
498 | |||
499 | if ($criteria->containsKey(BannerImageTableMap::COL_ID) && $criteria->keyContainsValue(BannerImageTableMap::COL_ID) ) { |
||
500 | throw new PropelException('Cannot insert a value for auto-increment primary key ('.BannerImageTableMap::COL_ID.')'); |
||
501 | } |
||
502 | |||
503 | |||
504 | // Set the correct dbName |
||
505 | $query = BannerImageQuery::create()->mergeWith($criteria); |
||
506 | |||
507 | // use transaction because $criteria could contain info |
||
508 | // for more than one table (I guess, conceivably) |
||
509 | return $con->transaction(function () use ($con, $query) { |
||
510 | return $query->doInsert($con); |
||
511 | }); |
||
512 | } |
||
513 | |||
514 | } // BannerImageTableMap |
||
515 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
||
516 | // |
||
517 | BannerImageTableMap::buildTableMap(); |
||
518 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.