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\CategoryPeer;
13: use Thelia\Model\ContentAssoc;
14: use Thelia\Model\ContentAssocPeer;
15: use Thelia\Model\ContentPeer;
16: use Thelia\Model\ProductPeer;
17: use Thelia\Model\map\ContentAssocTableMap;
18:
19: 20: 21: 22: 23: 24: 25:
26: abstract class BaseContentAssocPeer
27: {
28:
29:
30: const DATABASE_NAME = 'thelia';
31:
32:
33: const TABLE_NAME = 'content_assoc';
34:
35:
36: const OM_CLASS = 'Thelia\\Model\\ContentAssoc';
37:
38:
39: const TM_CLASS = 'ContentAssocTableMap';
40:
41:
42: const NUM_COLUMNS = 7;
43:
44:
45: const NUM_LAZY_LOAD_COLUMNS = 0;
46:
47:
48: const NUM_HYDRATE_COLUMNS = 7;
49:
50:
51: const ID = 'content_assoc.ID';
52:
53:
54: const CATEGORY_ID = 'content_assoc.CATEGORY_ID';
55:
56:
57: const PRODUCT_ID = 'content_assoc.PRODUCT_ID';
58:
59:
60: const CONTENT_ID = 'content_assoc.CONTENT_ID';
61:
62:
63: const POSITION = 'content_assoc.POSITION';
64:
65:
66: const CREATED_AT = 'content_assoc.CREATED_AT';
67:
68:
69: const UPDATED_AT = 'content_assoc.UPDATED_AT';
70:
71:
72: const DEFAULT_STRING_FORMAT = 'YAML';
73:
74: 75: 76: 77: 78: 79:
80: public static $instances = array();
81:
82:
83: 84: 85: 86: 87: 88:
89: protected static $fieldNames = array (
90: BasePeer::TYPE_PHPNAME => array ('Id', 'CategoryId', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ),
91: BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'categoryId', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ),
92: BasePeer::TYPE_COLNAME => array (ContentAssocPeer::ID, ContentAssocPeer::CATEGORY_ID, ContentAssocPeer::PRODUCT_ID, ContentAssocPeer::CONTENT_ID, ContentAssocPeer::POSITION, ContentAssocPeer::CREATED_AT, ContentAssocPeer::UPDATED_AT, ),
93: BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CATEGORY_ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
94: BasePeer::TYPE_FIELDNAME => array ('id', 'category_id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ),
95: BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
96: );
97:
98: 99: 100: 101: 102: 103:
104: protected static $fieldKeys = array (
105: BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'CategoryId' => 1, 'ProductId' => 2, 'ContentId' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
106: BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'categoryId' => 1, 'productId' => 2, 'contentId' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
107: BasePeer::TYPE_COLNAME => array (ContentAssocPeer::ID => 0, ContentAssocPeer::CATEGORY_ID => 1, ContentAssocPeer::PRODUCT_ID => 2, ContentAssocPeer::CONTENT_ID => 3, ContentAssocPeer::POSITION => 4, ContentAssocPeer::CREATED_AT => 5, ContentAssocPeer::UPDATED_AT => 6, ),
108: BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CATEGORY_ID' => 1, 'PRODUCT_ID' => 2, 'CONTENT_ID' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
109: BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'category_id' => 1, 'product_id' => 2, 'content_id' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
110: BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
111: );
112:
113: 114: 115: 116: 117: 118: 119: 120: 121: 122:
123: public static function translateFieldName($name, $fromType, $toType)
124: {
125: $toNames = ContentAssocPeer::getFieldNames($toType);
126: $key = isset(ContentAssocPeer::$fieldKeys[$fromType][$name]) ? ContentAssocPeer::$fieldKeys[$fromType][$name] : null;
127: if ($key === null) {
128: throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ContentAssocPeer::$fieldKeys[$fromType], true));
129: }
130:
131: return $toNames[$key];
132: }
133:
134: 135: 136: 137: 138: 139: 140: 141: 142:
143: public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
144: {
145: if (!array_key_exists($type, ContentAssocPeer::$fieldNames)) {
146: 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.');
147: }
148:
149: return ContentAssocPeer::$fieldNames[$type];
150: }
151:
152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163:
164: public static function alias($alias, $column)
165: {
166: return str_replace(ContentAssocPeer::TABLE_NAME.'.', $alias.'.', $column);
167: }
168:
169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180:
181: public static function addSelectColumns(Criteria $criteria, $alias = null)
182: {
183: if (null === $alias) {
184: $criteria->addSelectColumn(ContentAssocPeer::ID);
185: $criteria->addSelectColumn(ContentAssocPeer::CATEGORY_ID);
186: $criteria->addSelectColumn(ContentAssocPeer::PRODUCT_ID);
187: $criteria->addSelectColumn(ContentAssocPeer::CONTENT_ID);
188: $criteria->addSelectColumn(ContentAssocPeer::POSITION);
189: $criteria->addSelectColumn(ContentAssocPeer::CREATED_AT);
190: $criteria->addSelectColumn(ContentAssocPeer::UPDATED_AT);
191: } else {
192: $criteria->addSelectColumn($alias . '.ID');
193: $criteria->addSelectColumn($alias . '.CATEGORY_ID');
194: $criteria->addSelectColumn($alias . '.PRODUCT_ID');
195: $criteria->addSelectColumn($alias . '.CONTENT_ID');
196: $criteria->addSelectColumn($alias . '.POSITION');
197: $criteria->addSelectColumn($alias . '.CREATED_AT');
198: $criteria->addSelectColumn($alias . '.UPDATED_AT');
199: }
200: }
201:
202: 203: 204: 205: 206: 207: 208: 209:
210: public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
211: {
212:
213: $criteria = clone $criteria;
214:
215:
216:
217:
218: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
219:
220: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
221: $criteria->setDistinct();
222: }
223:
224: if (!$criteria->hasSelectClause()) {
225: ContentAssocPeer::addSelectColumns($criteria);
226: }
227:
228: $criteria->clearOrderByColumns();
229: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
230:
231: if ($con === null) {
232: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
233: }
234:
235: $stmt = BasePeer::doCount($criteria, $con);
236:
237: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
238: $count = (int) $row[0];
239: } else {
240: $count = 0;
241: }
242: $stmt->closeCursor();
243:
244: return $count;
245: }
246: 247: 248: 249: 250: 251: 252: 253: 254:
255: public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
256: {
257: $critcopy = clone $criteria;
258: $critcopy->setLimit(1);
259: $objects = ContentAssocPeer::doSelect($critcopy, $con);
260: if ($objects) {
261: return $objects[0];
262: }
263:
264: return null;
265: }
266: 267: 268: 269: 270: 271: 272: 273: 274:
275: public static function doSelect(Criteria $criteria, PropelPDO $con = null)
276: {
277: return ContentAssocPeer::populateObjects(ContentAssocPeer::doSelectStmt($criteria, $con));
278: }
279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291:
292: public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
293: {
294: if ($con === null) {
295: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
296: }
297:
298: if (!$criteria->hasSelectClause()) {
299: $criteria = clone $criteria;
300: ContentAssocPeer::addSelectColumns($criteria);
301: }
302:
303:
304: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
305:
306:
307: return BasePeer::doSelect($criteria, $con);
308: }
309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320:
321: public static function addInstanceToPool($obj, $key = null)
322: {
323: if (Propel::isInstancePoolingEnabled()) {
324: if ($key === null) {
325: $key = (string) $obj->getId();
326: }
327: ContentAssocPeer::$instances[$key] = $obj;
328: }
329: }
330:
331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343:
344: public static function removeInstanceFromPool($value)
345: {
346: if (Propel::isInstancePoolingEnabled() && $value !== null) {
347: if (is_object($value) && $value instanceof ContentAssoc) {
348: $key = (string) $value->getId();
349: } elseif (is_scalar($value)) {
350:
351: $key = (string) $value;
352: } else {
353: $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ContentAssoc object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
354: throw $e;
355: }
356:
357: unset(ContentAssocPeer::$instances[$key]);
358: }
359: }
360:
361: 362: 363: 364: 365: 366: 367: 368: 369: 370:
371: public static function getInstanceFromPool($key)
372: {
373: if (Propel::isInstancePoolingEnabled()) {
374: if (isset(ContentAssocPeer::$instances[$key])) {
375: return ContentAssocPeer::$instances[$key];
376: }
377: }
378:
379: return null;
380: }
381:
382: 383: 384: 385: 386:
387: public static function clearInstancePool()
388: {
389: ContentAssocPeer::$instances = array();
390: }
391:
392: 393: 394: 395:
396: public static function clearRelatedInstancePool()
397: {
398: }
399:
400: 401: 402: 403: 404: 405: 406: 407: 408: 409:
410: public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
411: {
412:
413: if ($row[$startcol] === null) {
414: return null;
415: }
416:
417: return (string) $row[$startcol];
418: }
419:
420: 421: 422: 423: 424: 425: 426: 427: 428:
429: public static function getPrimaryKeyFromRow($row, $startcol = 0)
430: {
431:
432: return (int) $row[$startcol];
433: }
434:
435: 436: 437: 438: 439: 440: 441:
442: public static function populateObjects(PDOStatement $stmt)
443: {
444: $results = array();
445:
446:
447: $cls = ContentAssocPeer::getOMClass();
448:
449: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
450: $key = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
451: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool($key))) {
452:
453:
454:
455: $results[] = $obj;
456: } else {
457: $obj = new $cls();
458: $obj->hydrate($row);
459: $results[] = $obj;
460: ContentAssocPeer::addInstanceToPool($obj, $key);
461: }
462: }
463: $stmt->closeCursor();
464:
465: return $results;
466: }
467: 468: 469: 470: 471: 472: 473: 474: 475:
476: public static function populateObject($row, $startcol = 0)
477: {
478: $key = ContentAssocPeer::getPrimaryKeyHashFromRow($row, $startcol);
479: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool($key))) {
480:
481:
482:
483: $col = $startcol + ContentAssocPeer::NUM_HYDRATE_COLUMNS;
484: } else {
485: $cls = ContentAssocPeer::OM_CLASS;
486: $obj = new $cls();
487: $col = $obj->hydrate($row, $startcol);
488: ContentAssocPeer::addInstanceToPool($obj, $key);
489: }
490:
491: return array($obj, $col);
492: }
493:
494:
495: 496: 497: 498: 499: 500: 501: 502: 503:
504: public static function doCountJoinCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
505: {
506:
507: $criteria = clone $criteria;
508:
509:
510:
511:
512: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
513:
514: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
515: $criteria->setDistinct();
516: }
517:
518: if (!$criteria->hasSelectClause()) {
519: ContentAssocPeer::addSelectColumns($criteria);
520: }
521:
522: $criteria->clearOrderByColumns();
523:
524:
525: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
526:
527: if ($con === null) {
528: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
529: }
530:
531: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
532:
533: $stmt = BasePeer::doCount($criteria, $con);
534:
535: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
536: $count = (int) $row[0];
537: } else {
538: $count = 0;
539: }
540: $stmt->closeCursor();
541:
542: return $count;
543: }
544:
545:
546: 547: 548: 549: 550: 551: 552: 553: 554:
555: public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
556: {
557:
558: $criteria = clone $criteria;
559:
560:
561:
562:
563: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
564:
565: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
566: $criteria->setDistinct();
567: }
568:
569: if (!$criteria->hasSelectClause()) {
570: ContentAssocPeer::addSelectColumns($criteria);
571: }
572:
573: $criteria->clearOrderByColumns();
574:
575:
576: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
577:
578: if ($con === null) {
579: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
580: }
581:
582: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
583:
584: $stmt = BasePeer::doCount($criteria, $con);
585:
586: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
587: $count = (int) $row[0];
588: } else {
589: $count = 0;
590: }
591: $stmt->closeCursor();
592:
593: return $count;
594: }
595:
596:
597: 598: 599: 600: 601: 602: 603: 604: 605:
606: public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
607: {
608:
609: $criteria = clone $criteria;
610:
611:
612:
613:
614: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
615:
616: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
617: $criteria->setDistinct();
618: }
619:
620: if (!$criteria->hasSelectClause()) {
621: ContentAssocPeer::addSelectColumns($criteria);
622: }
623:
624: $criteria->clearOrderByColumns();
625:
626:
627: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
628:
629: if ($con === null) {
630: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
631: }
632:
633: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
634:
635: $stmt = BasePeer::doCount($criteria, $con);
636:
637: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
638: $count = (int) $row[0];
639: } else {
640: $count = 0;
641: }
642: $stmt->closeCursor();
643:
644: return $count;
645: }
646:
647:
648: 649: 650: 651: 652: 653: 654: 655: 656:
657: public static function doSelectJoinCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
658: {
659: $criteria = clone $criteria;
660:
661:
662: if ($criteria->getDbName() == Propel::getDefaultDB()) {
663: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
664: }
665:
666: ContentAssocPeer::addSelectColumns($criteria);
667: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
668: CategoryPeer::addSelectColumns($criteria);
669:
670: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
671:
672: $stmt = BasePeer::doSelect($criteria, $con);
673: $results = array();
674:
675: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
676: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
677: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
678:
679:
680:
681: } else {
682:
683: $cls = ContentAssocPeer::getOMClass();
684:
685: $obj1 = new $cls();
686: $obj1->hydrate($row);
687: ContentAssocPeer::addInstanceToPool($obj1, $key1);
688: }
689:
690: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
691: if ($key2 !== null) {
692: $obj2 = CategoryPeer::getInstanceFromPool($key2);
693: if (!$obj2) {
694:
695: $cls = CategoryPeer::getOMClass();
696:
697: $obj2 = new $cls();
698: $obj2->hydrate($row, $startcol);
699: CategoryPeer::addInstanceToPool($obj2, $key2);
700: }
701:
702:
703: $obj2->addContentAssoc($obj1);
704:
705: }
706:
707: $results[] = $obj1;
708: }
709: $stmt->closeCursor();
710:
711: return $results;
712: }
713:
714:
715: 716: 717: 718: 719: 720: 721: 722: 723:
724: public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
725: {
726: $criteria = clone $criteria;
727:
728:
729: if ($criteria->getDbName() == Propel::getDefaultDB()) {
730: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
731: }
732:
733: ContentAssocPeer::addSelectColumns($criteria);
734: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
735: ProductPeer::addSelectColumns($criteria);
736:
737: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
738:
739: $stmt = BasePeer::doSelect($criteria, $con);
740: $results = array();
741:
742: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
743: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
744: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
745:
746:
747:
748: } else {
749:
750: $cls = ContentAssocPeer::getOMClass();
751:
752: $obj1 = new $cls();
753: $obj1->hydrate($row);
754: ContentAssocPeer::addInstanceToPool($obj1, $key1);
755: }
756:
757: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
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, $startcol);
766: ProductPeer::addInstanceToPool($obj2, $key2);
767: }
768:
769:
770: $obj2->addContentAssoc($obj1);
771:
772: }
773:
774: $results[] = $obj1;
775: }
776: $stmt->closeCursor();
777:
778: return $results;
779: }
780:
781:
782: 783: 784: 785: 786: 787: 788: 789: 790:
791: public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
792: {
793: $criteria = clone $criteria;
794:
795:
796: if ($criteria->getDbName() == Propel::getDefaultDB()) {
797: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
798: }
799:
800: ContentAssocPeer::addSelectColumns($criteria);
801: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
802: ContentPeer::addSelectColumns($criteria);
803:
804: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
805:
806: $stmt = BasePeer::doSelect($criteria, $con);
807: $results = array();
808:
809: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
810: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
811: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
812:
813:
814:
815: } else {
816:
817: $cls = ContentAssocPeer::getOMClass();
818:
819: $obj1 = new $cls();
820: $obj1->hydrate($row);
821: ContentAssocPeer::addInstanceToPool($obj1, $key1);
822: }
823:
824: $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
825: if ($key2 !== null) {
826: $obj2 = ContentPeer::getInstanceFromPool($key2);
827: if (!$obj2) {
828:
829: $cls = ContentPeer::getOMClass();
830:
831: $obj2 = new $cls();
832: $obj2->hydrate($row, $startcol);
833: ContentPeer::addInstanceToPool($obj2, $key2);
834: }
835:
836:
837: $obj2->addContentAssoc($obj1);
838:
839: }
840:
841: $results[] = $obj1;
842: }
843: $stmt->closeCursor();
844:
845: return $results;
846: }
847:
848:
849: 850: 851: 852: 853: 854: 855: 856: 857:
858: public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
859: {
860:
861: $criteria = clone $criteria;
862:
863:
864:
865:
866: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
867:
868: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
869: $criteria->setDistinct();
870: }
871:
872: if (!$criteria->hasSelectClause()) {
873: ContentAssocPeer::addSelectColumns($criteria);
874: }
875:
876: $criteria->clearOrderByColumns();
877:
878:
879: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
880:
881: if ($con === null) {
882: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
883: }
884:
885: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
886:
887: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
888:
889: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
890:
891: $stmt = BasePeer::doCount($criteria, $con);
892:
893: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
894: $count = (int) $row[0];
895: } else {
896: $count = 0;
897: }
898: $stmt->closeCursor();
899:
900: return $count;
901: }
902:
903: 904: 905: 906: 907: 908: 909: 910: 911: 912:
913: public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
914: {
915: $criteria = clone $criteria;
916:
917:
918: if ($criteria->getDbName() == Propel::getDefaultDB()) {
919: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
920: }
921:
922: ContentAssocPeer::addSelectColumns($criteria);
923: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
924:
925: CategoryPeer::addSelectColumns($criteria);
926: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
927:
928: ProductPeer::addSelectColumns($criteria);
929: $startcol4 = $startcol3 + ProductPeer::NUM_HYDRATE_COLUMNS;
930:
931: ContentPeer::addSelectColumns($criteria);
932: $startcol5 = $startcol4 + ContentPeer::NUM_HYDRATE_COLUMNS;
933:
934: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
935:
936: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
937:
938: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
939:
940: $stmt = BasePeer::doSelect($criteria, $con);
941: $results = array();
942:
943: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
944: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
945: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
946:
947:
948:
949: } else {
950: $cls = ContentAssocPeer::getOMClass();
951:
952: $obj1 = new $cls();
953: $obj1->hydrate($row);
954: ContentAssocPeer::addInstanceToPool($obj1, $key1);
955: }
956:
957:
958:
959: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
960: if ($key2 !== null) {
961: $obj2 = CategoryPeer::getInstanceFromPool($key2);
962: if (!$obj2) {
963:
964: $cls = CategoryPeer::getOMClass();
965:
966: $obj2 = new $cls();
967: $obj2->hydrate($row, $startcol2);
968: CategoryPeer::addInstanceToPool($obj2, $key2);
969: }
970:
971:
972: $obj2->addContentAssoc($obj1);
973: }
974:
975:
976:
977: $key3 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol3);
978: if ($key3 !== null) {
979: $obj3 = ProductPeer::getInstanceFromPool($key3);
980: if (!$obj3) {
981:
982: $cls = ProductPeer::getOMClass();
983:
984: $obj3 = new $cls();
985: $obj3->hydrate($row, $startcol3);
986: ProductPeer::addInstanceToPool($obj3, $key3);
987: }
988:
989:
990: $obj3->addContentAssoc($obj1);
991: }
992:
993:
994:
995: $key4 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
996: if ($key4 !== null) {
997: $obj4 = ContentPeer::getInstanceFromPool($key4);
998: if (!$obj4) {
999:
1000: $cls = ContentPeer::getOMClass();
1001:
1002: $obj4 = new $cls();
1003: $obj4->hydrate($row, $startcol4);
1004: ContentPeer::addInstanceToPool($obj4, $key4);
1005: }
1006:
1007:
1008: $obj4->addContentAssoc($obj1);
1009: }
1010:
1011: $results[] = $obj1;
1012: }
1013: $stmt->closeCursor();
1014:
1015: return $results;
1016: }
1017:
1018:
1019: 1020: 1021: 1022: 1023: 1024: 1025: 1026: 1027:
1028: public static function doCountJoinAllExceptCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1029: {
1030:
1031: $criteria = clone $criteria;
1032:
1033:
1034:
1035:
1036: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1037:
1038: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1039: $criteria->setDistinct();
1040: }
1041:
1042: if (!$criteria->hasSelectClause()) {
1043: ContentAssocPeer::addSelectColumns($criteria);
1044: }
1045:
1046: $criteria->clearOrderByColumns();
1047:
1048:
1049: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1050:
1051: if ($con === null) {
1052: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1053: }
1054:
1055: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1056:
1057: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1058:
1059: $stmt = BasePeer::doCount($criteria, $con);
1060:
1061: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1062: $count = (int) $row[0];
1063: } else {
1064: $count = 0;
1065: }
1066: $stmt->closeCursor();
1067:
1068: return $count;
1069: }
1070:
1071:
1072: 1073: 1074: 1075: 1076: 1077: 1078: 1079: 1080:
1081: public static function doCountJoinAllExceptProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1082: {
1083:
1084: $criteria = clone $criteria;
1085:
1086:
1087:
1088:
1089: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1090:
1091: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1092: $criteria->setDistinct();
1093: }
1094:
1095: if (!$criteria->hasSelectClause()) {
1096: ContentAssocPeer::addSelectColumns($criteria);
1097: }
1098:
1099: $criteria->clearOrderByColumns();
1100:
1101:
1102: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1103:
1104: if ($con === null) {
1105: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1106: }
1107:
1108: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1109:
1110: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1111:
1112: $stmt = BasePeer::doCount($criteria, $con);
1113:
1114: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1115: $count = (int) $row[0];
1116: } else {
1117: $count = 0;
1118: }
1119: $stmt->closeCursor();
1120:
1121: return $count;
1122: }
1123:
1124:
1125: 1126: 1127: 1128: 1129: 1130: 1131: 1132: 1133:
1134: public static function doCountJoinAllExceptContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1135: {
1136:
1137: $criteria = clone $criteria;
1138:
1139:
1140:
1141:
1142: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1143:
1144: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1145: $criteria->setDistinct();
1146: }
1147:
1148: if (!$criteria->hasSelectClause()) {
1149: ContentAssocPeer::addSelectColumns($criteria);
1150: }
1151:
1152: $criteria->clearOrderByColumns();
1153:
1154:
1155: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1156:
1157: if ($con === null) {
1158: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1159: }
1160:
1161: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1162:
1163: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1164:
1165: $stmt = BasePeer::doCount($criteria, $con);
1166:
1167: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1168: $count = (int) $row[0];
1169: } else {
1170: $count = 0;
1171: }
1172: $stmt->closeCursor();
1173:
1174: return $count;
1175: }
1176:
1177:
1178: 1179: 1180: 1181: 1182: 1183: 1184: 1185: 1186: 1187:
1188: public static function doSelectJoinAllExceptCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1189: {
1190: $criteria = clone $criteria;
1191:
1192:
1193:
1194:
1195: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1196: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1197: }
1198:
1199: ContentAssocPeer::addSelectColumns($criteria);
1200: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1201:
1202: ProductPeer::addSelectColumns($criteria);
1203: $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1204:
1205: ContentPeer::addSelectColumns($criteria);
1206: $startcol4 = $startcol3 + ContentPeer::NUM_HYDRATE_COLUMNS;
1207:
1208: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1209:
1210: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1211:
1212:
1213: $stmt = BasePeer::doSelect($criteria, $con);
1214: $results = array();
1215:
1216: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1217: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1218: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1219:
1220:
1221:
1222: } else {
1223: $cls = ContentAssocPeer::getOMClass();
1224:
1225: $obj1 = new $cls();
1226: $obj1->hydrate($row);
1227: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1228: }
1229:
1230:
1231:
1232: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1233: if ($key2 !== null) {
1234: $obj2 = ProductPeer::getInstanceFromPool($key2);
1235: if (!$obj2) {
1236:
1237: $cls = ProductPeer::getOMClass();
1238:
1239: $obj2 = new $cls();
1240: $obj2->hydrate($row, $startcol2);
1241: ProductPeer::addInstanceToPool($obj2, $key2);
1242: }
1243:
1244:
1245: $obj2->addContentAssoc($obj1);
1246:
1247: }
1248:
1249:
1250:
1251: $key3 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1252: if ($key3 !== null) {
1253: $obj3 = ContentPeer::getInstanceFromPool($key3);
1254: if (!$obj3) {
1255:
1256: $cls = ContentPeer::getOMClass();
1257:
1258: $obj3 = new $cls();
1259: $obj3->hydrate($row, $startcol3);
1260: ContentPeer::addInstanceToPool($obj3, $key3);
1261: }
1262:
1263:
1264: $obj3->addContentAssoc($obj1);
1265:
1266: }
1267:
1268: $results[] = $obj1;
1269: }
1270: $stmt->closeCursor();
1271:
1272: return $results;
1273: }
1274:
1275:
1276: 1277: 1278: 1279: 1280: 1281: 1282: 1283: 1284: 1285:
1286: public static function doSelectJoinAllExceptProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1287: {
1288: $criteria = clone $criteria;
1289:
1290:
1291:
1292:
1293: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1294: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1295: }
1296:
1297: ContentAssocPeer::addSelectColumns($criteria);
1298: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1299:
1300: CategoryPeer::addSelectColumns($criteria);
1301: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1302:
1303: ContentPeer::addSelectColumns($criteria);
1304: $startcol4 = $startcol3 + ContentPeer::NUM_HYDRATE_COLUMNS;
1305:
1306: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1307:
1308: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1309:
1310:
1311: $stmt = BasePeer::doSelect($criteria, $con);
1312: $results = array();
1313:
1314: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1315: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1316: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1317:
1318:
1319:
1320: } else {
1321: $cls = ContentAssocPeer::getOMClass();
1322:
1323: $obj1 = new $cls();
1324: $obj1->hydrate($row);
1325: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1326: }
1327:
1328:
1329:
1330: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1331: if ($key2 !== null) {
1332: $obj2 = CategoryPeer::getInstanceFromPool($key2);
1333: if (!$obj2) {
1334:
1335: $cls = CategoryPeer::getOMClass();
1336:
1337: $obj2 = new $cls();
1338: $obj2->hydrate($row, $startcol2);
1339: CategoryPeer::addInstanceToPool($obj2, $key2);
1340: }
1341:
1342:
1343: $obj2->addContentAssoc($obj1);
1344:
1345: }
1346:
1347:
1348:
1349: $key3 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1350: if ($key3 !== null) {
1351: $obj3 = ContentPeer::getInstanceFromPool($key3);
1352: if (!$obj3) {
1353:
1354: $cls = ContentPeer::getOMClass();
1355:
1356: $obj3 = new $cls();
1357: $obj3->hydrate($row, $startcol3);
1358: ContentPeer::addInstanceToPool($obj3, $key3);
1359: }
1360:
1361:
1362: $obj3->addContentAssoc($obj1);
1363:
1364: }
1365:
1366: $results[] = $obj1;
1367: }
1368: $stmt->closeCursor();
1369:
1370: return $results;
1371: }
1372:
1373:
1374: 1375: 1376: 1377: 1378: 1379: 1380: 1381: 1382: 1383:
1384: public static function doSelectJoinAllExceptContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1385: {
1386: $criteria = clone $criteria;
1387:
1388:
1389:
1390:
1391: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1392: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1393: }
1394:
1395: ContentAssocPeer::addSelectColumns($criteria);
1396: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1397:
1398: CategoryPeer::addSelectColumns($criteria);
1399: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1400:
1401: ProductPeer::addSelectColumns($criteria);
1402: $startcol4 = $startcol3 + ProductPeer::NUM_HYDRATE_COLUMNS;
1403:
1404: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1405:
1406: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1407:
1408:
1409: $stmt = BasePeer::doSelect($criteria, $con);
1410: $results = array();
1411:
1412: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1413: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1414: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1415:
1416:
1417:
1418: } else {
1419: $cls = ContentAssocPeer::getOMClass();
1420:
1421: $obj1 = new $cls();
1422: $obj1->hydrate($row);
1423: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1424: }
1425:
1426:
1427:
1428: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1429: if ($key2 !== null) {
1430: $obj2 = CategoryPeer::getInstanceFromPool($key2);
1431: if (!$obj2) {
1432:
1433: $cls = CategoryPeer::getOMClass();
1434:
1435: $obj2 = new $cls();
1436: $obj2->hydrate($row, $startcol2);
1437: CategoryPeer::addInstanceToPool($obj2, $key2);
1438: }
1439:
1440:
1441: $obj2->addContentAssoc($obj1);
1442:
1443: }
1444:
1445:
1446:
1447: $key3 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1448: if ($key3 !== null) {
1449: $obj3 = ProductPeer::getInstanceFromPool($key3);
1450: if (!$obj3) {
1451:
1452: $cls = ProductPeer::getOMClass();
1453:
1454: $obj3 = new $cls();
1455: $obj3->hydrate($row, $startcol3);
1456: ProductPeer::addInstanceToPool($obj3, $key3);
1457: }
1458:
1459:
1460: $obj3->addContentAssoc($obj1);
1461:
1462: }
1463:
1464: $results[] = $obj1;
1465: }
1466: $stmt->closeCursor();
1467:
1468: return $results;
1469: }
1470:
1471: 1472: 1473: 1474: 1475: 1476: 1477:
1478: public static function getTableMap()
1479: {
1480: return Propel::getDatabaseMap(ContentAssocPeer::DATABASE_NAME)->getTable(ContentAssocPeer::TABLE_NAME);
1481: }
1482:
1483: 1484: 1485:
1486: public static function buildTableMap()
1487: {
1488: $dbMap = Propel::getDatabaseMap(BaseContentAssocPeer::DATABASE_NAME);
1489: if (!$dbMap->hasTable(BaseContentAssocPeer::TABLE_NAME)) {
1490: $dbMap->addTableObject(new ContentAssocTableMap());
1491: }
1492: }
1493:
1494: 1495: 1496: 1497: 1498: 1499:
1500: public static function getOMClass()
1501: {
1502: return ContentAssocPeer::OM_CLASS;
1503: }
1504:
1505: 1506: 1507: 1508: 1509: 1510: 1511: 1512: 1513:
1514: public static function doInsert($values, PropelPDO $con = null)
1515: {
1516: if ($con === null) {
1517: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1518: }
1519:
1520: if ($values instanceof Criteria) {
1521: $criteria = clone $values;
1522: } else {
1523: $criteria = $values->buildCriteria();
1524: }
1525:
1526: if ($criteria->containsKey(ContentAssocPeer::ID) && $criteria->keyContainsValue(ContentAssocPeer::ID) ) {
1527: throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentAssocPeer::ID.')');
1528: }
1529:
1530:
1531:
1532: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1533:
1534: try {
1535:
1536:
1537: $con->beginTransaction();
1538: $pk = BasePeer::doInsert($criteria, $con);
1539: $con->commit();
1540: } catch (PropelException $e) {
1541: $con->rollBack();
1542: throw $e;
1543: }
1544:
1545: return $pk;
1546: }
1547:
1548: 1549: 1550: 1551: 1552: 1553: 1554: 1555: 1556:
1557: public static function doUpdate($values, PropelPDO $con = null)
1558: {
1559: if ($con === null) {
1560: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1561: }
1562:
1563: $selectCriteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1564:
1565: if ($values instanceof Criteria) {
1566: $criteria = clone $values;
1567:
1568: $comparison = $criteria->getComparison(ContentAssocPeer::ID);
1569: $value = $criteria->remove(ContentAssocPeer::ID);
1570: if ($value) {
1571: $selectCriteria->add(ContentAssocPeer::ID, $value, $comparison);
1572: } else {
1573: $selectCriteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1574: }
1575:
1576: } else {
1577: $criteria = $values->buildCriteria();
1578: $selectCriteria = $values->buildPkeyCriteria();
1579: }
1580:
1581:
1582: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1583:
1584: return BasePeer::doUpdate($selectCriteria, $criteria, $con);
1585: }
1586:
1587: 1588: 1589: 1590: 1591: 1592: 1593:
1594: public static function doDeleteAll(PropelPDO $con = null)
1595: {
1596: if ($con === null) {
1597: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1598: }
1599: $affectedRows = 0;
1600: try {
1601:
1602:
1603: $con->beginTransaction();
1604: $affectedRows += BasePeer::doDeleteAll(ContentAssocPeer::TABLE_NAME, $con, ContentAssocPeer::DATABASE_NAME);
1605:
1606:
1607:
1608: ContentAssocPeer::clearInstancePool();
1609: ContentAssocPeer::clearRelatedInstancePool();
1610: $con->commit();
1611:
1612: return $affectedRows;
1613: } catch (PropelException $e) {
1614: $con->rollBack();
1615: throw $e;
1616: }
1617: }
1618:
1619: 1620: 1621: 1622: 1623: 1624: 1625: 1626: 1627: 1628: 1629:
1630: public static function doDelete($values, PropelPDO $con = null)
1631: {
1632: if ($con === null) {
1633: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1634: }
1635:
1636: if ($values instanceof Criteria) {
1637:
1638:
1639:
1640: ContentAssocPeer::clearInstancePool();
1641:
1642: $criteria = clone $values;
1643: } elseif ($values instanceof ContentAssoc) {
1644:
1645: ContentAssocPeer::removeInstanceFromPool($values);
1646:
1647: $criteria = $values->buildPkeyCriteria();
1648: } else {
1649: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1650: $criteria->add(ContentAssocPeer::ID, (array) $values, Criteria::IN);
1651:
1652: foreach ((array) $values as $singleval) {
1653: ContentAssocPeer::removeInstanceFromPool($singleval);
1654: }
1655: }
1656:
1657:
1658: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1659:
1660: $affectedRows = 0;
1661:
1662: try {
1663:
1664:
1665: $con->beginTransaction();
1666:
1667: $affectedRows += BasePeer::doDelete($criteria, $con);
1668: ContentAssocPeer::clearRelatedInstancePool();
1669: $con->commit();
1670:
1671: return $affectedRows;
1672: } catch (PropelException $e) {
1673: $con->rollBack();
1674: throw $e;
1675: }
1676: }
1677:
1678: 1679: 1680: 1681: 1682: 1683: 1684: 1685: 1686: 1687: 1688: 1689:
1690: public static function doValidate($obj, $cols = null)
1691: {
1692: $columns = array();
1693:
1694: if ($cols) {
1695: $dbMap = Propel::getDatabaseMap(ContentAssocPeer::DATABASE_NAME);
1696: $tableMap = $dbMap->getTable(ContentAssocPeer::TABLE_NAME);
1697:
1698: if (! is_array($cols)) {
1699: $cols = array($cols);
1700: }
1701:
1702: foreach ($cols as $colName) {
1703: if ($tableMap->hasColumn($colName)) {
1704: $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1705: $columns[$colName] = $obj->$get();
1706: }
1707: }
1708: } else {
1709:
1710: }
1711:
1712: return BasePeer::doValidate(ContentAssocPeer::DATABASE_NAME, ContentAssocPeer::TABLE_NAME, $columns);
1713: }
1714:
1715: 1716: 1717: 1718: 1719: 1720: 1721:
1722: public static function retrieveByPK($pk, PropelPDO $con = null)
1723: {
1724:
1725: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool((string) $pk))) {
1726: return $obj;
1727: }
1728:
1729: if ($con === null) {
1730: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1731: }
1732:
1733: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1734: $criteria->add(ContentAssocPeer::ID, $pk);
1735:
1736: $v = ContentAssocPeer::doSelect($criteria, $con);
1737:
1738: return !empty($v) > 0 ? $v[0] : null;
1739: }
1740:
1741: 1742: 1743: 1744: 1745: 1746: 1747: 1748: 1749:
1750: public static function retrieveByPKs($pks, PropelPDO $con = null)
1751: {
1752: if ($con === null) {
1753: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1754: }
1755:
1756: $objs = null;
1757: if (empty($pks)) {
1758: $objs = array();
1759: } else {
1760: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1761: $criteria->add(ContentAssocPeer::ID, $pks, Criteria::IN);
1762: $objs = ContentAssocPeer::doSelect($criteria, $con);
1763: }
1764:
1765: return $objs;
1766: }
1767:
1768: }
1769:
1770:
1771:
1772: BaseContentAssocPeer::buildTableMap();
1773:
1774: