1: <?php
2:
3: namespace Thelia\Model\om;
4:
5: use \BasePeer;
6: use \Criteria;
7: use \PDO;
8: use \PDOStatement;
9: use \Propel;
10: use \PropelException;
11: use \PropelPDO;
12: use Thelia\Model\ProductPeer;
13: use Thelia\Model\ProductVersion;
14: use Thelia\Model\ProductVersionPeer;
15: use Thelia\Model\map\ProductVersionTableMap;
16:
17: 18: 19: 20: 21: 22: 23:
24: abstract class BaseProductVersionPeer
25: {
26:
27:
28: const DATABASE_NAME = 'thelia';
29:
30:
31: const TABLE_NAME = 'product_version';
32:
33:
34: const OM_CLASS = 'Thelia\\Model\\ProductVersion';
35:
36:
37: const TM_CLASS = 'ProductVersionTableMap';
38:
39:
40: const NUM_COLUMNS = 17;
41:
42:
43: const NUM_LAZY_LOAD_COLUMNS = 0;
44:
45:
46: const NUM_HYDRATE_COLUMNS = 17;
47:
48:
49: const ID = 'product_version.id';
50:
51:
52: const TAX_RULE_ID = 'product_version.tax_rule_id';
53:
54:
55: const REF = 'product_version.ref';
56:
57:
58: const PRICE = 'product_version.price';
59:
60:
61: const PRICE2 = 'product_version.price2';
62:
63:
64: const ECOTAX = 'product_version.ecotax';
65:
66:
67: const NEWNESS = 'product_version.newness';
68:
69:
70: const PROMO = 'product_version.promo';
71:
72:
73: const STOCK = 'product_version.stock';
74:
75:
76: const VISIBLE = 'product_version.visible';
77:
78:
79: const WEIGHT = 'product_version.weight';
80:
81:
82: const POSITION = 'product_version.position';
83:
84:
85: const CREATED_AT = 'product_version.created_at';
86:
87:
88: const UPDATED_AT = 'product_version.updated_at';
89:
90:
91: const VERSION = 'product_version.version';
92:
93:
94: const VERSION_CREATED_AT = 'product_version.version_created_at';
95:
96:
97: const VERSION_CREATED_BY = 'product_version.version_created_by';
98:
99:
100: const DEFAULT_STRING_FORMAT = 'YAML';
101:
102: 103: 104: 105: 106: 107:
108: public static $instances = array();
109:
110:
111: 112: 113: 114: 115: 116:
117: protected static $fieldNames = array (
118: BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Stock', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
119: BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
120: BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID, ProductVersionPeer::TAX_RULE_ID, ProductVersionPeer::REF, ProductVersionPeer::PRICE, ProductVersionPeer::PRICE2, ProductVersionPeer::ECOTAX, ProductVersionPeer::NEWNESS, ProductVersionPeer::PROMO, ProductVersionPeer::STOCK, ProductVersionPeer::VISIBLE, ProductVersionPeer::WEIGHT, ProductVersionPeer::POSITION, ProductVersionPeer::CREATED_AT, ProductVersionPeer::UPDATED_AT, ProductVersionPeer::VERSION, ProductVersionPeer::VERSION_CREATED_AT, ProductVersionPeer::VERSION_CREATED_BY, ),
121: BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'STOCK', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
122: BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
123: BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
124: );
125:
126: 127: 128: 129: 130: 131:
132: protected static $fieldKeys = array (
133: BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Stock' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ),
134: BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ),
135: BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID => 0, ProductVersionPeer::TAX_RULE_ID => 1, ProductVersionPeer::REF => 2, ProductVersionPeer::PRICE => 3, ProductVersionPeer::PRICE2 => 4, ProductVersionPeer::ECOTAX => 5, ProductVersionPeer::NEWNESS => 6, ProductVersionPeer::PROMO => 7, ProductVersionPeer::STOCK => 8, ProductVersionPeer::VISIBLE => 9, ProductVersionPeer::WEIGHT => 10, ProductVersionPeer::POSITION => 11, ProductVersionPeer::CREATED_AT => 12, ProductVersionPeer::UPDATED_AT => 13, ProductVersionPeer::VERSION => 14, ProductVersionPeer::VERSION_CREATED_AT => 15, ProductVersionPeer::VERSION_CREATED_BY => 16, ),
136: BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'STOCK' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ),
137: BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ),
138: BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
139: );
140:
141: 142: 143: 144: 145: 146: 147: 148: 149: 150:
151: public static function translateFieldName($name, $fromType, $toType)
152: {
153: $toNames = ProductVersionPeer::getFieldNames($toType);
154: $key = isset(ProductVersionPeer::$fieldKeys[$fromType][$name]) ? ProductVersionPeer::$fieldKeys[$fromType][$name] : null;
155: if ($key === null) {
156: throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ProductVersionPeer::$fieldKeys[$fromType], true));
157: }
158:
159: return $toNames[$key];
160: }
161:
162: 163: 164: 165: 166: 167: 168: 169: 170:
171: public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
172: {
173: if (!array_key_exists($type, ProductVersionPeer::$fieldNames)) {
174: throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
175: }
176:
177: return ProductVersionPeer::$fieldNames[$type];
178: }
179:
180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191:
192: public static function alias($alias, $column)
193: {
194: return str_replace(ProductVersionPeer::TABLE_NAME.'.', $alias.'.', $column);
195: }
196:
197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208:
209: public static function addSelectColumns(Criteria $criteria, $alias = null)
210: {
211: if (null === $alias) {
212: $criteria->addSelectColumn(ProductVersionPeer::ID);
213: $criteria->addSelectColumn(ProductVersionPeer::TAX_RULE_ID);
214: $criteria->addSelectColumn(ProductVersionPeer::REF);
215: $criteria->addSelectColumn(ProductVersionPeer::PRICE);
216: $criteria->addSelectColumn(ProductVersionPeer::PRICE2);
217: $criteria->addSelectColumn(ProductVersionPeer::ECOTAX);
218: $criteria->addSelectColumn(ProductVersionPeer::NEWNESS);
219: $criteria->addSelectColumn(ProductVersionPeer::PROMO);
220: $criteria->addSelectColumn(ProductVersionPeer::STOCK);
221: $criteria->addSelectColumn(ProductVersionPeer::VISIBLE);
222: $criteria->addSelectColumn(ProductVersionPeer::WEIGHT);
223: $criteria->addSelectColumn(ProductVersionPeer::POSITION);
224: $criteria->addSelectColumn(ProductVersionPeer::CREATED_AT);
225: $criteria->addSelectColumn(ProductVersionPeer::UPDATED_AT);
226: $criteria->addSelectColumn(ProductVersionPeer::VERSION);
227: $criteria->addSelectColumn(ProductVersionPeer::VERSION_CREATED_AT);
228: $criteria->addSelectColumn(ProductVersionPeer::VERSION_CREATED_BY);
229: } else {
230: $criteria->addSelectColumn($alias . '.id');
231: $criteria->addSelectColumn($alias . '.tax_rule_id');
232: $criteria->addSelectColumn($alias . '.ref');
233: $criteria->addSelectColumn($alias . '.price');
234: $criteria->addSelectColumn($alias . '.price2');
235: $criteria->addSelectColumn($alias . '.ecotax');
236: $criteria->addSelectColumn($alias . '.newness');
237: $criteria->addSelectColumn($alias . '.promo');
238: $criteria->addSelectColumn($alias . '.stock');
239: $criteria->addSelectColumn($alias . '.visible');
240: $criteria->addSelectColumn($alias . '.weight');
241: $criteria->addSelectColumn($alias . '.position');
242: $criteria->addSelectColumn($alias . '.created_at');
243: $criteria->addSelectColumn($alias . '.updated_at');
244: $criteria->addSelectColumn($alias . '.version');
245: $criteria->addSelectColumn($alias . '.version_created_at');
246: $criteria->addSelectColumn($alias . '.version_created_by');
247: }
248: }
249:
250: 251: 252: 253: 254: 255: 256: 257:
258: public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
259: {
260:
261: $criteria = clone $criteria;
262:
263:
264:
265:
266: $criteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
267:
268: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
269: $criteria->setDistinct();
270: }
271:
272: if (!$criteria->hasSelectClause()) {
273: ProductVersionPeer::addSelectColumns($criteria);
274: }
275:
276: $criteria->clearOrderByColumns();
277: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
278:
279: if ($con === null) {
280: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
281: }
282:
283: $stmt = BasePeer::doCount($criteria, $con);
284:
285: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
286: $count = (int) $row[0];
287: } else {
288: $count = 0;
289: }
290: $stmt->closeCursor();
291:
292: return $count;
293: }
294: 295: 296: 297: 298: 299: 300: 301: 302:
303: public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
304: {
305: $critcopy = clone $criteria;
306: $critcopy->setLimit(1);
307: $objects = ProductVersionPeer::doSelect($critcopy, $con);
308: if ($objects) {
309: return $objects[0];
310: }
311:
312: return null;
313: }
314: 315: 316: 317: 318: 319: 320: 321: 322:
323: public static function doSelect(Criteria $criteria, PropelPDO $con = null)
324: {
325: return ProductVersionPeer::populateObjects(ProductVersionPeer::doSelectStmt($criteria, $con));
326: }
327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339:
340: public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
341: {
342: if ($con === null) {
343: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
344: }
345:
346: if (!$criteria->hasSelectClause()) {
347: $criteria = clone $criteria;
348: ProductVersionPeer::addSelectColumns($criteria);
349: }
350:
351:
352: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
353:
354:
355: return BasePeer::doSelect($criteria, $con);
356: }
357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368:
369: public static function addInstanceToPool($obj, $key = null)
370: {
371: if (Propel::isInstancePoolingEnabled()) {
372: if ($key === null) {
373: $key = serialize(array((string) $obj->getId(), (string) $obj->getVersion()));
374: }
375: ProductVersionPeer::$instances[$key] = $obj;
376: }
377: }
378:
379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391:
392: public static function removeInstanceFromPool($value)
393: {
394: if (Propel::isInstancePoolingEnabled() && $value !== null) {
395: if (is_object($value) && $value instanceof ProductVersion) {
396: $key = serialize(array((string) $value->getId(), (string) $value->getVersion()));
397: } elseif (is_array($value) && count($value) === 2) {
398:
399: $key = serialize(array((string) $value[0], (string) $value[1]));
400: } else {
401: $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ProductVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
402: throw $e;
403: }
404:
405: unset(ProductVersionPeer::$instances[$key]);
406: }
407: }
408:
409: 410: 411: 412: 413: 414: 415: 416: 417: 418:
419: public static function getInstanceFromPool($key)
420: {
421: if (Propel::isInstancePoolingEnabled()) {
422: if (isset(ProductVersionPeer::$instances[$key])) {
423: return ProductVersionPeer::$instances[$key];
424: }
425: }
426:
427: return null;
428: }
429:
430: 431: 432: 433: 434:
435: public static function clearInstancePool($and_clear_all_references = false)
436: {
437: if ($and_clear_all_references)
438: {
439: foreach (ProductVersionPeer::$instances as $instance)
440: {
441: $instance->clearAllReferences(true);
442: }
443: }
444: ProductVersionPeer::$instances = array();
445: }
446:
447: 448: 449: 450:
451: public static function clearRelatedInstancePool()
452: {
453: }
454:
455: 456: 457: 458: 459: 460: 461: 462: 463: 464:
465: public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
466: {
467:
468: if ($row[$startcol] === null && $row[$startcol + 14] === null) {
469: return null;
470: }
471:
472: return serialize(array((string) $row[$startcol], (string) $row[$startcol + 14]));
473: }
474:
475: 476: 477: 478: 479: 480: 481: 482: 483:
484: public static function getPrimaryKeyFromRow($row, $startcol = 0)
485: {
486:
487: return array((int) $row[$startcol], (int) $row[$startcol + 14]);
488: }
489:
490: 491: 492: 493: 494: 495: 496:
497: public static function populateObjects(PDOStatement $stmt)
498: {
499: $results = array();
500:
501:
502: $cls = ProductVersionPeer::getOMClass();
503:
504: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
505: $key = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
506: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($key))) {
507:
508:
509:
510: $results[] = $obj;
511: } else {
512: $obj = new $cls();
513: $obj->hydrate($row);
514: $results[] = $obj;
515: ProductVersionPeer::addInstanceToPool($obj, $key);
516: }
517: }
518: $stmt->closeCursor();
519:
520: return $results;
521: }
522: 523: 524: 525: 526: 527: 528: 529: 530:
531: public static function populateObject($row, $startcol = 0)
532: {
533: $key = ProductVersionPeer::getPrimaryKeyHashFromRow($row, $startcol);
534: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($key))) {
535:
536:
537:
538: $col = $startcol + ProductVersionPeer::NUM_HYDRATE_COLUMNS;
539: } else {
540: $cls = ProductVersionPeer::OM_CLASS;
541: $obj = new $cls();
542: $col = $obj->hydrate($row, $startcol);
543: ProductVersionPeer::addInstanceToPool($obj, $key);
544: }
545:
546: return array($obj, $col);
547: }
548:
549:
550: 551: 552: 553: 554: 555: 556: 557: 558:
559: public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
560: {
561:
562: $criteria = clone $criteria;
563:
564:
565:
566:
567: $criteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
568:
569: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
570: $criteria->setDistinct();
571: }
572:
573: if (!$criteria->hasSelectClause()) {
574: ProductVersionPeer::addSelectColumns($criteria);
575: }
576:
577: $criteria->clearOrderByColumns();
578:
579:
580: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
581:
582: if ($con === null) {
583: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
584: }
585:
586: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
587:
588: $stmt = BasePeer::doCount($criteria, $con);
589:
590: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
591: $count = (int) $row[0];
592: } else {
593: $count = 0;
594: }
595: $stmt->closeCursor();
596:
597: return $count;
598: }
599:
600:
601: 602: 603: 604: 605: 606: 607: 608: 609:
610: public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
611: {
612: $criteria = clone $criteria;
613:
614:
615: if ($criteria->getDbName() == Propel::getDefaultDB()) {
616: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
617: }
618:
619: ProductVersionPeer::addSelectColumns($criteria);
620: $startcol = ProductVersionPeer::NUM_HYDRATE_COLUMNS;
621: ProductPeer::addSelectColumns($criteria);
622:
623: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
624:
625: $stmt = BasePeer::doSelect($criteria, $con);
626: $results = array();
627:
628: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
629: $key1 = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
630: if (null !== ($obj1 = ProductVersionPeer::getInstanceFromPool($key1))) {
631:
632:
633:
634: } else {
635:
636: $cls = ProductVersionPeer::getOMClass();
637:
638: $obj1 = new $cls();
639: $obj1->hydrate($row);
640: ProductVersionPeer::addInstanceToPool($obj1, $key1);
641: }
642:
643: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
644: if ($key2 !== null) {
645: $obj2 = ProductPeer::getInstanceFromPool($key2);
646: if (!$obj2) {
647:
648: $cls = ProductPeer::getOMClass();
649:
650: $obj2 = new $cls();
651: $obj2->hydrate($row, $startcol);
652: ProductPeer::addInstanceToPool($obj2, $key2);
653: }
654:
655:
656: $obj2->addProductVersion($obj1);
657:
658: }
659:
660: $results[] = $obj1;
661: }
662: $stmt->closeCursor();
663:
664: return $results;
665: }
666:
667:
668: 669: 670: 671: 672: 673: 674: 675: 676:
677: public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
678: {
679:
680: $criteria = clone $criteria;
681:
682:
683:
684:
685: $criteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
686:
687: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
688: $criteria->setDistinct();
689: }
690:
691: if (!$criteria->hasSelectClause()) {
692: ProductVersionPeer::addSelectColumns($criteria);
693: }
694:
695: $criteria->clearOrderByColumns();
696:
697:
698: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
699:
700: if ($con === null) {
701: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
702: }
703:
704: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
705:
706: $stmt = BasePeer::doCount($criteria, $con);
707:
708: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
709: $count = (int) $row[0];
710: } else {
711: $count = 0;
712: }
713: $stmt->closeCursor();
714:
715: return $count;
716: }
717:
718: 719: 720: 721: 722: 723: 724: 725: 726: 727:
728: public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
729: {
730: $criteria = clone $criteria;
731:
732:
733: if ($criteria->getDbName() == Propel::getDefaultDB()) {
734: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
735: }
736:
737: ProductVersionPeer::addSelectColumns($criteria);
738: $startcol2 = ProductVersionPeer::NUM_HYDRATE_COLUMNS;
739:
740: ProductPeer::addSelectColumns($criteria);
741: $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
742:
743: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
744:
745: $stmt = BasePeer::doSelect($criteria, $con);
746: $results = array();
747:
748: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
749: $key1 = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
750: if (null !== ($obj1 = ProductVersionPeer::getInstanceFromPool($key1))) {
751:
752:
753:
754: } else {
755: $cls = ProductVersionPeer::getOMClass();
756:
757: $obj1 = new $cls();
758: $obj1->hydrate($row);
759: ProductVersionPeer::addInstanceToPool($obj1, $key1);
760: }
761:
762:
763:
764: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
765: if ($key2 !== null) {
766: $obj2 = ProductPeer::getInstanceFromPool($key2);
767: if (!$obj2) {
768:
769: $cls = ProductPeer::getOMClass();
770:
771: $obj2 = new $cls();
772: $obj2->hydrate($row, $startcol2);
773: ProductPeer::addInstanceToPool($obj2, $key2);
774: }
775:
776:
777: $obj2->addProductVersion($obj1);
778: }
779:
780: $results[] = $obj1;
781: }
782: $stmt->closeCursor();
783:
784: return $results;
785: }
786:
787: 788: 789: 790: 791: 792: 793:
794: public static function getTableMap()
795: {
796: return Propel::getDatabaseMap(ProductVersionPeer::DATABASE_NAME)->getTable(ProductVersionPeer::TABLE_NAME);
797: }
798:
799: 800: 801:
802: public static function buildTableMap()
803: {
804: $dbMap = Propel::getDatabaseMap(BaseProductVersionPeer::DATABASE_NAME);
805: if (!$dbMap->hasTable(BaseProductVersionPeer::TABLE_NAME)) {
806: $dbMap->addTableObject(new ProductVersionTableMap());
807: }
808: }
809:
810: 811: 812: 813: 814: 815:
816: public static function getOMClass($row = 0, $colnum = 0)
817: {
818: return ProductVersionPeer::OM_CLASS;
819: }
820:
821: 822: 823: 824: 825: 826: 827: 828: 829:
830: public static function doInsert($values, PropelPDO $con = null)
831: {
832: if ($con === null) {
833: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
834: }
835:
836: if ($values instanceof Criteria) {
837: $criteria = clone $values;
838: } else {
839: $criteria = $values->buildCriteria();
840: }
841:
842:
843:
844: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
845:
846: try {
847:
848:
849: $con->beginTransaction();
850: $pk = BasePeer::doInsert($criteria, $con);
851: $con->commit();
852: } catch (PropelException $e) {
853: $con->rollBack();
854: throw $e;
855: }
856:
857: return $pk;
858: }
859:
860: 861: 862: 863: 864: 865: 866: 867: 868:
869: public static function doUpdate($values, PropelPDO $con = null)
870: {
871: if ($con === null) {
872: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
873: }
874:
875: $selectCriteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
876:
877: if ($values instanceof Criteria) {
878: $criteria = clone $values;
879:
880: $comparison = $criteria->getComparison(ProductVersionPeer::ID);
881: $value = $criteria->remove(ProductVersionPeer::ID);
882: if ($value) {
883: $selectCriteria->add(ProductVersionPeer::ID, $value, $comparison);
884: } else {
885: $selectCriteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
886: }
887:
888: $comparison = $criteria->getComparison(ProductVersionPeer::VERSION);
889: $value = $criteria->remove(ProductVersionPeer::VERSION);
890: if ($value) {
891: $selectCriteria->add(ProductVersionPeer::VERSION, $value, $comparison);
892: } else {
893: $selectCriteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
894: }
895:
896: } else {
897: $criteria = $values->buildCriteria();
898: $selectCriteria = $values->buildPkeyCriteria();
899: }
900:
901:
902: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
903:
904: return BasePeer::doUpdate($selectCriteria, $criteria, $con);
905: }
906:
907: 908: 909: 910: 911: 912: 913:
914: public static function doDeleteAll(PropelPDO $con = null)
915: {
916: if ($con === null) {
917: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
918: }
919: $affectedRows = 0;
920: try {
921:
922:
923: $con->beginTransaction();
924: $affectedRows += BasePeer::doDeleteAll(ProductVersionPeer::TABLE_NAME, $con, ProductVersionPeer::DATABASE_NAME);
925:
926:
927:
928: ProductVersionPeer::clearInstancePool();
929: ProductVersionPeer::clearRelatedInstancePool();
930: $con->commit();
931:
932: return $affectedRows;
933: } catch (PropelException $e) {
934: $con->rollBack();
935: throw $e;
936: }
937: }
938:
939: 940: 941: 942: 943: 944: 945: 946: 947: 948: 949:
950: public static function doDelete($values, PropelPDO $con = null)
951: {
952: if ($con === null) {
953: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
954: }
955:
956: if ($values instanceof Criteria) {
957:
958:
959:
960: ProductVersionPeer::clearInstancePool();
961:
962: $criteria = clone $values;
963: } elseif ($values instanceof ProductVersion) {
964:
965: ProductVersionPeer::removeInstanceFromPool($values);
966:
967: $criteria = $values->buildPkeyCriteria();
968: } else {
969: $criteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
970:
971:
972: if (count($values) == count($values, COUNT_RECURSIVE)) {
973:
974: $values = array($values);
975: }
976: foreach ($values as $value) {
977: $criterion = $criteria->getNewCriterion(ProductVersionPeer::ID, $value[0]);
978: $criterion->addAnd($criteria->getNewCriterion(ProductVersionPeer::VERSION, $value[1]));
979: $criteria->addOr($criterion);
980:
981: ProductVersionPeer::removeInstanceFromPool($value);
982: }
983: }
984:
985:
986: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
987:
988: $affectedRows = 0;
989:
990: try {
991:
992:
993: $con->beginTransaction();
994:
995: $affectedRows += BasePeer::doDelete($criteria, $con);
996: ProductVersionPeer::clearRelatedInstancePool();
997: $con->commit();
998:
999: return $affectedRows;
1000: } catch (PropelException $e) {
1001: $con->rollBack();
1002: throw $e;
1003: }
1004: }
1005:
1006: 1007: 1008: 1009: 1010: 1011: 1012: 1013: 1014: 1015: 1016: 1017:
1018: public static function doValidate($obj, $cols = null)
1019: {
1020: $columns = array();
1021:
1022: if ($cols) {
1023: $dbMap = Propel::getDatabaseMap(ProductVersionPeer::DATABASE_NAME);
1024: $tableMap = $dbMap->getTable(ProductVersionPeer::TABLE_NAME);
1025:
1026: if (! is_array($cols)) {
1027: $cols = array($cols);
1028: }
1029:
1030: foreach ($cols as $colName) {
1031: if ($tableMap->hasColumn($colName)) {
1032: $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1033: $columns[$colName] = $obj->$get();
1034: }
1035: }
1036: } else {
1037:
1038: }
1039:
1040: return BasePeer::doValidate(ProductVersionPeer::DATABASE_NAME, ProductVersionPeer::TABLE_NAME, $columns);
1041: }
1042:
1043: 1044: 1045: 1046: 1047: 1048: 1049:
1050: public static function retrieveByPK($id, $version, PropelPDO $con = null) {
1051: $_instancePoolKey = serialize(array((string) $id, (string) $version));
1052: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($_instancePoolKey))) {
1053: return $obj;
1054: }
1055:
1056: if ($con === null) {
1057: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1058: }
1059: $criteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
1060: $criteria->add(ProductVersionPeer::ID, $id);
1061: $criteria->add(ProductVersionPeer::VERSION, $version);
1062: $v = ProductVersionPeer::doSelect($criteria, $con);
1063:
1064: return !empty($v) ? $v[0] : null;
1065: }
1066: }
1067:
1068:
1069:
1070: BaseProductVersionPeer::buildTableMap();
1071:
1072: