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()
436: {
437: ProductVersionPeer::$instances = array();
438: }
439:
440: 441: 442: 443:
444: public static function clearRelatedInstancePool()
445: {
446: }
447:
448: 449: 450: 451: 452: 453: 454: 455: 456: 457:
458: public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
459: {
460:
461: if ($row[$startcol] === null && $row[$startcol + 14] === null) {
462: return null;
463: }
464:
465: return serialize(array((string) $row[$startcol], (string) $row[$startcol + 14]));
466: }
467:
468: 469: 470: 471: 472: 473: 474: 475: 476:
477: public static function getPrimaryKeyFromRow($row, $startcol = 0)
478: {
479:
480: return array((int) $row[$startcol], (int) $row[$startcol + 14]);
481: }
482:
483: 484: 485: 486: 487: 488: 489:
490: public static function populateObjects(PDOStatement $stmt)
491: {
492: $results = array();
493:
494:
495: $cls = ProductVersionPeer::getOMClass();
496:
497: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
498: $key = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
499: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($key))) {
500:
501:
502:
503: $results[] = $obj;
504: } else {
505: $obj = new $cls();
506: $obj->hydrate($row);
507: $results[] = $obj;
508: ProductVersionPeer::addInstanceToPool($obj, $key);
509: }
510: }
511: $stmt->closeCursor();
512:
513: return $results;
514: }
515: 516: 517: 518: 519: 520: 521: 522: 523:
524: public static function populateObject($row, $startcol = 0)
525: {
526: $key = ProductVersionPeer::getPrimaryKeyHashFromRow($row, $startcol);
527: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($key))) {
528:
529:
530:
531: $col = $startcol + ProductVersionPeer::NUM_HYDRATE_COLUMNS;
532: } else {
533: $cls = ProductVersionPeer::OM_CLASS;
534: $obj = new $cls();
535: $col = $obj->hydrate($row, $startcol);
536: ProductVersionPeer::addInstanceToPool($obj, $key);
537: }
538:
539: return array($obj, $col);
540: }
541:
542:
543: 544: 545: 546: 547: 548: 549: 550: 551:
552: public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
553: {
554:
555: $criteria = clone $criteria;
556:
557:
558:
559:
560: $criteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
561:
562: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
563: $criteria->setDistinct();
564: }
565:
566: if (!$criteria->hasSelectClause()) {
567: ProductVersionPeer::addSelectColumns($criteria);
568: }
569:
570: $criteria->clearOrderByColumns();
571:
572:
573: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
574:
575: if ($con === null) {
576: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
577: }
578:
579: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
580:
581: $stmt = BasePeer::doCount($criteria, $con);
582:
583: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
584: $count = (int) $row[0];
585: } else {
586: $count = 0;
587: }
588: $stmt->closeCursor();
589:
590: return $count;
591: }
592:
593:
594: 595: 596: 597: 598: 599: 600: 601: 602:
603: public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
604: {
605: $criteria = clone $criteria;
606:
607:
608: if ($criteria->getDbName() == Propel::getDefaultDB()) {
609: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
610: }
611:
612: ProductVersionPeer::addSelectColumns($criteria);
613: $startcol = ProductVersionPeer::NUM_HYDRATE_COLUMNS;
614: ProductPeer::addSelectColumns($criteria);
615:
616: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
617:
618: $stmt = BasePeer::doSelect($criteria, $con);
619: $results = array();
620:
621: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
622: $key1 = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
623: if (null !== ($obj1 = ProductVersionPeer::getInstanceFromPool($key1))) {
624:
625:
626:
627: } else {
628:
629: $cls = ProductVersionPeer::getOMClass();
630:
631: $obj1 = new $cls();
632: $obj1->hydrate($row);
633: ProductVersionPeer::addInstanceToPool($obj1, $key1);
634: }
635:
636: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
637: if ($key2 !== null) {
638: $obj2 = ProductPeer::getInstanceFromPool($key2);
639: if (!$obj2) {
640:
641: $cls = ProductPeer::getOMClass();
642:
643: $obj2 = new $cls();
644: $obj2->hydrate($row, $startcol);
645: ProductPeer::addInstanceToPool($obj2, $key2);
646: }
647:
648:
649: $obj2->addProductVersion($obj1);
650:
651: }
652:
653: $results[] = $obj1;
654: }
655: $stmt->closeCursor();
656:
657: return $results;
658: }
659:
660:
661: 662: 663: 664: 665: 666: 667: 668: 669:
670: public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
671: {
672:
673: $criteria = clone $criteria;
674:
675:
676:
677:
678: $criteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
679:
680: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
681: $criteria->setDistinct();
682: }
683:
684: if (!$criteria->hasSelectClause()) {
685: ProductVersionPeer::addSelectColumns($criteria);
686: }
687:
688: $criteria->clearOrderByColumns();
689:
690:
691: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
692:
693: if ($con === null) {
694: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
695: }
696:
697: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
698:
699: $stmt = BasePeer::doCount($criteria, $con);
700:
701: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
702: $count = (int) $row[0];
703: } else {
704: $count = 0;
705: }
706: $stmt->closeCursor();
707:
708: return $count;
709: }
710:
711: 712: 713: 714: 715: 716: 717: 718: 719: 720:
721: public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
722: {
723: $criteria = clone $criteria;
724:
725:
726: if ($criteria->getDbName() == Propel::getDefaultDB()) {
727: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
728: }
729:
730: ProductVersionPeer::addSelectColumns($criteria);
731: $startcol2 = ProductVersionPeer::NUM_HYDRATE_COLUMNS;
732:
733: ProductPeer::addSelectColumns($criteria);
734: $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
735:
736: $criteria->addJoin(ProductVersionPeer::ID, ProductPeer::ID, $join_behavior);
737:
738: $stmt = BasePeer::doSelect($criteria, $con);
739: $results = array();
740:
741: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
742: $key1 = ProductVersionPeer::getPrimaryKeyHashFromRow($row, 0);
743: if (null !== ($obj1 = ProductVersionPeer::getInstanceFromPool($key1))) {
744:
745:
746:
747: } else {
748: $cls = ProductVersionPeer::getOMClass();
749:
750: $obj1 = new $cls();
751: $obj1->hydrate($row);
752: ProductVersionPeer::addInstanceToPool($obj1, $key1);
753: }
754:
755:
756:
757: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
758: if ($key2 !== null) {
759: $obj2 = ProductPeer::getInstanceFromPool($key2);
760: if (!$obj2) {
761:
762: $cls = ProductPeer::getOMClass();
763:
764: $obj2 = new $cls();
765: $obj2->hydrate($row, $startcol2);
766: ProductPeer::addInstanceToPool($obj2, $key2);
767: }
768:
769:
770: $obj2->addProductVersion($obj1);
771: }
772:
773: $results[] = $obj1;
774: }
775: $stmt->closeCursor();
776:
777: return $results;
778: }
779:
780: 781: 782: 783: 784: 785: 786:
787: public static function getTableMap()
788: {
789: return Propel::getDatabaseMap(ProductVersionPeer::DATABASE_NAME)->getTable(ProductVersionPeer::TABLE_NAME);
790: }
791:
792: 793: 794:
795: public static function buildTableMap()
796: {
797: $dbMap = Propel::getDatabaseMap(BaseProductVersionPeer::DATABASE_NAME);
798: if (!$dbMap->hasTable(BaseProductVersionPeer::TABLE_NAME)) {
799: $dbMap->addTableObject(new ProductVersionTableMap());
800: }
801: }
802:
803: 804: 805: 806: 807: 808:
809: public static function getOMClass()
810: {
811: return ProductVersionPeer::OM_CLASS;
812: }
813:
814: 815: 816: 817: 818: 819: 820: 821: 822:
823: public static function doInsert($values, PropelPDO $con = null)
824: {
825: if ($con === null) {
826: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
827: }
828:
829: if ($values instanceof Criteria) {
830: $criteria = clone $values;
831: } else {
832: $criteria = $values->buildCriteria();
833: }
834:
835:
836:
837: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
838:
839: try {
840:
841:
842: $con->beginTransaction();
843: $pk = BasePeer::doInsert($criteria, $con);
844: $con->commit();
845: } catch (PropelException $e) {
846: $con->rollBack();
847: throw $e;
848: }
849:
850: return $pk;
851: }
852:
853: 854: 855: 856: 857: 858: 859: 860: 861:
862: public static function doUpdate($values, PropelPDO $con = null)
863: {
864: if ($con === null) {
865: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
866: }
867:
868: $selectCriteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
869:
870: if ($values instanceof Criteria) {
871: $criteria = clone $values;
872:
873: $comparison = $criteria->getComparison(ProductVersionPeer::ID);
874: $value = $criteria->remove(ProductVersionPeer::ID);
875: if ($value) {
876: $selectCriteria->add(ProductVersionPeer::ID, $value, $comparison);
877: } else {
878: $selectCriteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
879: }
880:
881: $comparison = $criteria->getComparison(ProductVersionPeer::VERSION);
882: $value = $criteria->remove(ProductVersionPeer::VERSION);
883: if ($value) {
884: $selectCriteria->add(ProductVersionPeer::VERSION, $value, $comparison);
885: } else {
886: $selectCriteria->setPrimaryTableName(ProductVersionPeer::TABLE_NAME);
887: }
888:
889: } else {
890: $criteria = $values->buildCriteria();
891: $selectCriteria = $values->buildPkeyCriteria();
892: }
893:
894:
895: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
896:
897: return BasePeer::doUpdate($selectCriteria, $criteria, $con);
898: }
899:
900: 901: 902: 903: 904: 905: 906:
907: public static function doDeleteAll(PropelPDO $con = null)
908: {
909: if ($con === null) {
910: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
911: }
912: $affectedRows = 0;
913: try {
914:
915:
916: $con->beginTransaction();
917: $affectedRows += BasePeer::doDeleteAll(ProductVersionPeer::TABLE_NAME, $con, ProductVersionPeer::DATABASE_NAME);
918:
919:
920:
921: ProductVersionPeer::clearInstancePool();
922: ProductVersionPeer::clearRelatedInstancePool();
923: $con->commit();
924:
925: return $affectedRows;
926: } catch (PropelException $e) {
927: $con->rollBack();
928: throw $e;
929: }
930: }
931:
932: 933: 934: 935: 936: 937: 938: 939: 940: 941: 942:
943: public static function doDelete($values, PropelPDO $con = null)
944: {
945: if ($con === null) {
946: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
947: }
948:
949: if ($values instanceof Criteria) {
950:
951:
952:
953: ProductVersionPeer::clearInstancePool();
954:
955: $criteria = clone $values;
956: } elseif ($values instanceof ProductVersion) {
957:
958: ProductVersionPeer::removeInstanceFromPool($values);
959:
960: $criteria = $values->buildPkeyCriteria();
961: } else {
962: $criteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
963:
964:
965: if (count($values) == count($values, COUNT_RECURSIVE)) {
966:
967: $values = array($values);
968: }
969: foreach ($values as $value) {
970: $criterion = $criteria->getNewCriterion(ProductVersionPeer::ID, $value[0]);
971: $criterion->addAnd($criteria->getNewCriterion(ProductVersionPeer::VERSION, $value[1]));
972: $criteria->addOr($criterion);
973:
974: ProductVersionPeer::removeInstanceFromPool($value);
975: }
976: }
977:
978:
979: $criteria->setDbName(ProductVersionPeer::DATABASE_NAME);
980:
981: $affectedRows = 0;
982:
983: try {
984:
985:
986: $con->beginTransaction();
987:
988: $affectedRows += BasePeer::doDelete($criteria, $con);
989: ProductVersionPeer::clearRelatedInstancePool();
990: $con->commit();
991:
992: return $affectedRows;
993: } catch (PropelException $e) {
994: $con->rollBack();
995: throw $e;
996: }
997: }
998:
999: 1000: 1001: 1002: 1003: 1004: 1005: 1006: 1007: 1008: 1009: 1010:
1011: public static function doValidate($obj, $cols = null)
1012: {
1013: $columns = array();
1014:
1015: if ($cols) {
1016: $dbMap = Propel::getDatabaseMap(ProductVersionPeer::DATABASE_NAME);
1017: $tableMap = $dbMap->getTable(ProductVersionPeer::TABLE_NAME);
1018:
1019: if (! is_array($cols)) {
1020: $cols = array($cols);
1021: }
1022:
1023: foreach ($cols as $colName) {
1024: if ($tableMap->hasColumn($colName)) {
1025: $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1026: $columns[$colName] = $obj->$get();
1027: }
1028: }
1029: } else {
1030:
1031: }
1032:
1033: return BasePeer::doValidate(ProductVersionPeer::DATABASE_NAME, ProductVersionPeer::TABLE_NAME, $columns);
1034: }
1035:
1036: 1037: 1038: 1039: 1040: 1041: 1042:
1043: public static function retrieveByPK($id, $version, PropelPDO $con = null) {
1044: $_instancePoolKey = serialize(array((string) $id, (string) $version));
1045: if (null !== ($obj = ProductVersionPeer::getInstanceFromPool($_instancePoolKey))) {
1046: return $obj;
1047: }
1048:
1049: if ($con === null) {
1050: $con = Propel::getConnection(ProductVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1051: }
1052: $criteria = new Criteria(ProductVersionPeer::DATABASE_NAME);
1053: $criteria->add(ProductVersionPeer::ID, $id);
1054: $criteria->add(ProductVersionPeer::VERSION, $version);
1055: $v = ProductVersionPeer::doSelect($criteria, $con);
1056:
1057: return !empty($v) ? $v[0] : null;
1058: }
1059: }
1060:
1061:
1062:
1063: BaseProductVersionPeer::buildTableMap();
1064:
1065: