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($and_clear_all_references = false)
388: {
389: if ($and_clear_all_references)
390: {
391: foreach (ContentAssocPeer::$instances as $instance)
392: {
393: $instance->clearAllReferences(true);
394: }
395: }
396: ContentAssocPeer::$instances = array();
397: }
398:
399: 400: 401: 402:
403: public static function clearRelatedInstancePool()
404: {
405: }
406:
407: 408: 409: 410: 411: 412: 413: 414: 415: 416:
417: public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
418: {
419:
420: if ($row[$startcol] === null) {
421: return null;
422: }
423:
424: return (string) $row[$startcol];
425: }
426:
427: 428: 429: 430: 431: 432: 433: 434: 435:
436: public static function getPrimaryKeyFromRow($row, $startcol = 0)
437: {
438:
439: return (int) $row[$startcol];
440: }
441:
442: 443: 444: 445: 446: 447: 448:
449: public static function populateObjects(PDOStatement $stmt)
450: {
451: $results = array();
452:
453:
454: $cls = ContentAssocPeer::getOMClass();
455:
456: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
457: $key = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
458: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool($key))) {
459:
460:
461:
462: $results[] = $obj;
463: } else {
464: $obj = new $cls();
465: $obj->hydrate($row);
466: $results[] = $obj;
467: ContentAssocPeer::addInstanceToPool($obj, $key);
468: }
469: }
470: $stmt->closeCursor();
471:
472: return $results;
473: }
474: 475: 476: 477: 478: 479: 480: 481: 482:
483: public static function populateObject($row, $startcol = 0)
484: {
485: $key = ContentAssocPeer::getPrimaryKeyHashFromRow($row, $startcol);
486: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool($key))) {
487:
488:
489:
490: $col = $startcol + ContentAssocPeer::NUM_HYDRATE_COLUMNS;
491: } else {
492: $cls = ContentAssocPeer::OM_CLASS;
493: $obj = new $cls();
494: $col = $obj->hydrate($row, $startcol);
495: ContentAssocPeer::addInstanceToPool($obj, $key);
496: }
497:
498: return array($obj, $col);
499: }
500:
501:
502: 503: 504: 505: 506: 507: 508: 509: 510:
511: public static function doCountJoinCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
512: {
513:
514: $criteria = clone $criteria;
515:
516:
517:
518:
519: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
520:
521: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
522: $criteria->setDistinct();
523: }
524:
525: if (!$criteria->hasSelectClause()) {
526: ContentAssocPeer::addSelectColumns($criteria);
527: }
528:
529: $criteria->clearOrderByColumns();
530:
531:
532: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
533:
534: if ($con === null) {
535: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
536: }
537:
538: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
539:
540: $stmt = BasePeer::doCount($criteria, $con);
541:
542: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
543: $count = (int) $row[0];
544: } else {
545: $count = 0;
546: }
547: $stmt->closeCursor();
548:
549: return $count;
550: }
551:
552:
553: 554: 555: 556: 557: 558: 559: 560: 561:
562: public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
563: {
564:
565: $criteria = clone $criteria;
566:
567:
568:
569:
570: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
571:
572: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
573: $criteria->setDistinct();
574: }
575:
576: if (!$criteria->hasSelectClause()) {
577: ContentAssocPeer::addSelectColumns($criteria);
578: }
579:
580: $criteria->clearOrderByColumns();
581:
582:
583: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
584:
585: if ($con === null) {
586: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
587: }
588:
589: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
590:
591: $stmt = BasePeer::doCount($criteria, $con);
592:
593: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
594: $count = (int) $row[0];
595: } else {
596: $count = 0;
597: }
598: $stmt->closeCursor();
599:
600: return $count;
601: }
602:
603:
604: 605: 606: 607: 608: 609: 610: 611: 612:
613: public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
614: {
615:
616: $criteria = clone $criteria;
617:
618:
619:
620:
621: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
622:
623: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
624: $criteria->setDistinct();
625: }
626:
627: if (!$criteria->hasSelectClause()) {
628: ContentAssocPeer::addSelectColumns($criteria);
629: }
630:
631: $criteria->clearOrderByColumns();
632:
633:
634: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
635:
636: if ($con === null) {
637: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
638: }
639:
640: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
641:
642: $stmt = BasePeer::doCount($criteria, $con);
643:
644: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
645: $count = (int) $row[0];
646: } else {
647: $count = 0;
648: }
649: $stmt->closeCursor();
650:
651: return $count;
652: }
653:
654:
655: 656: 657: 658: 659: 660: 661: 662: 663:
664: public static function doSelectJoinCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
665: {
666: $criteria = clone $criteria;
667:
668:
669: if ($criteria->getDbName() == Propel::getDefaultDB()) {
670: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
671: }
672:
673: ContentAssocPeer::addSelectColumns($criteria);
674: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
675: CategoryPeer::addSelectColumns($criteria);
676:
677: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
678:
679: $stmt = BasePeer::doSelect($criteria, $con);
680: $results = array();
681:
682: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
683: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
684: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
685:
686:
687:
688: } else {
689:
690: $cls = ContentAssocPeer::getOMClass();
691:
692: $obj1 = new $cls();
693: $obj1->hydrate($row);
694: ContentAssocPeer::addInstanceToPool($obj1, $key1);
695: }
696:
697: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
698: if ($key2 !== null) {
699: $obj2 = CategoryPeer::getInstanceFromPool($key2);
700: if (!$obj2) {
701:
702: $cls = CategoryPeer::getOMClass();
703:
704: $obj2 = new $cls();
705: $obj2->hydrate($row, $startcol);
706: CategoryPeer::addInstanceToPool($obj2, $key2);
707: }
708:
709:
710: $obj2->addContentAssoc($obj1);
711:
712: }
713:
714: $results[] = $obj1;
715: }
716: $stmt->closeCursor();
717:
718: return $results;
719: }
720:
721:
722: 723: 724: 725: 726: 727: 728: 729: 730:
731: public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
732: {
733: $criteria = clone $criteria;
734:
735:
736: if ($criteria->getDbName() == Propel::getDefaultDB()) {
737: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
738: }
739:
740: ContentAssocPeer::addSelectColumns($criteria);
741: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
742: ProductPeer::addSelectColumns($criteria);
743:
744: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
745:
746: $stmt = BasePeer::doSelect($criteria, $con);
747: $results = array();
748:
749: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
750: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
751: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
752:
753:
754:
755: } else {
756:
757: $cls = ContentAssocPeer::getOMClass();
758:
759: $obj1 = new $cls();
760: $obj1->hydrate($row);
761: ContentAssocPeer::addInstanceToPool($obj1, $key1);
762: }
763:
764: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
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, $startcol);
773: ProductPeer::addInstanceToPool($obj2, $key2);
774: }
775:
776:
777: $obj2->addContentAssoc($obj1);
778:
779: }
780:
781: $results[] = $obj1;
782: }
783: $stmt->closeCursor();
784:
785: return $results;
786: }
787:
788:
789: 790: 791: 792: 793: 794: 795: 796: 797:
798: public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
799: {
800: $criteria = clone $criteria;
801:
802:
803: if ($criteria->getDbName() == Propel::getDefaultDB()) {
804: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
805: }
806:
807: ContentAssocPeer::addSelectColumns($criteria);
808: $startcol = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
809: ContentPeer::addSelectColumns($criteria);
810:
811: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
812:
813: $stmt = BasePeer::doSelect($criteria, $con);
814: $results = array();
815:
816: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
817: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
818: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
819:
820:
821:
822: } else {
823:
824: $cls = ContentAssocPeer::getOMClass();
825:
826: $obj1 = new $cls();
827: $obj1->hydrate($row);
828: ContentAssocPeer::addInstanceToPool($obj1, $key1);
829: }
830:
831: $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
832: if ($key2 !== null) {
833: $obj2 = ContentPeer::getInstanceFromPool($key2);
834: if (!$obj2) {
835:
836: $cls = ContentPeer::getOMClass();
837:
838: $obj2 = new $cls();
839: $obj2->hydrate($row, $startcol);
840: ContentPeer::addInstanceToPool($obj2, $key2);
841: }
842:
843:
844: $obj2->addContentAssoc($obj1);
845:
846: }
847:
848: $results[] = $obj1;
849: }
850: $stmt->closeCursor();
851:
852: return $results;
853: }
854:
855:
856: 857: 858: 859: 860: 861: 862: 863: 864:
865: public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
866: {
867:
868: $criteria = clone $criteria;
869:
870:
871:
872:
873: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
874:
875: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
876: $criteria->setDistinct();
877: }
878:
879: if (!$criteria->hasSelectClause()) {
880: ContentAssocPeer::addSelectColumns($criteria);
881: }
882:
883: $criteria->clearOrderByColumns();
884:
885:
886: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
887:
888: if ($con === null) {
889: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
890: }
891:
892: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
893:
894: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
895:
896: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
897:
898: $stmt = BasePeer::doCount($criteria, $con);
899:
900: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
901: $count = (int) $row[0];
902: } else {
903: $count = 0;
904: }
905: $stmt->closeCursor();
906:
907: return $count;
908: }
909:
910: 911: 912: 913: 914: 915: 916: 917: 918: 919:
920: public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
921: {
922: $criteria = clone $criteria;
923:
924:
925: if ($criteria->getDbName() == Propel::getDefaultDB()) {
926: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
927: }
928:
929: ContentAssocPeer::addSelectColumns($criteria);
930: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
931:
932: CategoryPeer::addSelectColumns($criteria);
933: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
934:
935: ProductPeer::addSelectColumns($criteria);
936: $startcol4 = $startcol3 + ProductPeer::NUM_HYDRATE_COLUMNS;
937:
938: ContentPeer::addSelectColumns($criteria);
939: $startcol5 = $startcol4 + ContentPeer::NUM_HYDRATE_COLUMNS;
940:
941: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
942:
943: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
944:
945: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
946:
947: $stmt = BasePeer::doSelect($criteria, $con);
948: $results = array();
949:
950: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
951: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
952: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
953:
954:
955:
956: } else {
957: $cls = ContentAssocPeer::getOMClass();
958:
959: $obj1 = new $cls();
960: $obj1->hydrate($row);
961: ContentAssocPeer::addInstanceToPool($obj1, $key1);
962: }
963:
964:
965:
966: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
967: if ($key2 !== null) {
968: $obj2 = CategoryPeer::getInstanceFromPool($key2);
969: if (!$obj2) {
970:
971: $cls = CategoryPeer::getOMClass();
972:
973: $obj2 = new $cls();
974: $obj2->hydrate($row, $startcol2);
975: CategoryPeer::addInstanceToPool($obj2, $key2);
976: }
977:
978:
979: $obj2->addContentAssoc($obj1);
980: }
981:
982:
983:
984: $key3 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol3);
985: if ($key3 !== null) {
986: $obj3 = ProductPeer::getInstanceFromPool($key3);
987: if (!$obj3) {
988:
989: $cls = ProductPeer::getOMClass();
990:
991: $obj3 = new $cls();
992: $obj3->hydrate($row, $startcol3);
993: ProductPeer::addInstanceToPool($obj3, $key3);
994: }
995:
996:
997: $obj3->addContentAssoc($obj1);
998: }
999:
1000:
1001:
1002: $key4 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1003: if ($key4 !== null) {
1004: $obj4 = ContentPeer::getInstanceFromPool($key4);
1005: if (!$obj4) {
1006:
1007: $cls = ContentPeer::getOMClass();
1008:
1009: $obj4 = new $cls();
1010: $obj4->hydrate($row, $startcol4);
1011: ContentPeer::addInstanceToPool($obj4, $key4);
1012: }
1013:
1014:
1015: $obj4->addContentAssoc($obj1);
1016: }
1017:
1018: $results[] = $obj1;
1019: }
1020: $stmt->closeCursor();
1021:
1022: return $results;
1023: }
1024:
1025:
1026: 1027: 1028: 1029: 1030: 1031: 1032: 1033: 1034:
1035: public static function doCountJoinAllExceptCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1036: {
1037:
1038: $criteria = clone $criteria;
1039:
1040:
1041:
1042:
1043: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1044:
1045: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1046: $criteria->setDistinct();
1047: }
1048:
1049: if (!$criteria->hasSelectClause()) {
1050: ContentAssocPeer::addSelectColumns($criteria);
1051: }
1052:
1053: $criteria->clearOrderByColumns();
1054:
1055:
1056: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1057:
1058: if ($con === null) {
1059: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1060: }
1061:
1062: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1063:
1064: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1065:
1066: $stmt = BasePeer::doCount($criteria, $con);
1067:
1068: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1069: $count = (int) $row[0];
1070: } else {
1071: $count = 0;
1072: }
1073: $stmt->closeCursor();
1074:
1075: return $count;
1076: }
1077:
1078:
1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087:
1088: public static function doCountJoinAllExceptProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1089: {
1090:
1091: $criteria = clone $criteria;
1092:
1093:
1094:
1095:
1096: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1097:
1098: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1099: $criteria->setDistinct();
1100: }
1101:
1102: if (!$criteria->hasSelectClause()) {
1103: ContentAssocPeer::addSelectColumns($criteria);
1104: }
1105:
1106: $criteria->clearOrderByColumns();
1107:
1108:
1109: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1110:
1111: if ($con === null) {
1112: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1113: }
1114:
1115: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1116:
1117: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1118:
1119: $stmt = BasePeer::doCount($criteria, $con);
1120:
1121: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1122: $count = (int) $row[0];
1123: } else {
1124: $count = 0;
1125: }
1126: $stmt->closeCursor();
1127:
1128: return $count;
1129: }
1130:
1131:
1132: 1133: 1134: 1135: 1136: 1137: 1138: 1139: 1140:
1141: public static function doCountJoinAllExceptContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1142: {
1143:
1144: $criteria = clone $criteria;
1145:
1146:
1147:
1148:
1149: $criteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1150:
1151: if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1152: $criteria->setDistinct();
1153: }
1154:
1155: if (!$criteria->hasSelectClause()) {
1156: ContentAssocPeer::addSelectColumns($criteria);
1157: }
1158:
1159: $criteria->clearOrderByColumns();
1160:
1161:
1162: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1163:
1164: if ($con === null) {
1165: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1166: }
1167:
1168: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1169:
1170: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1171:
1172: $stmt = BasePeer::doCount($criteria, $con);
1173:
1174: if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1175: $count = (int) $row[0];
1176: } else {
1177: $count = 0;
1178: }
1179: $stmt->closeCursor();
1180:
1181: return $count;
1182: }
1183:
1184:
1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193: 1194:
1195: public static function doSelectJoinAllExceptCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1196: {
1197: $criteria = clone $criteria;
1198:
1199:
1200:
1201:
1202: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1203: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1204: }
1205:
1206: ContentAssocPeer::addSelectColumns($criteria);
1207: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1208:
1209: ProductPeer::addSelectColumns($criteria);
1210: $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
1211:
1212: ContentPeer::addSelectColumns($criteria);
1213: $startcol4 = $startcol3 + ContentPeer::NUM_HYDRATE_COLUMNS;
1214:
1215: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1216:
1217: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1218:
1219:
1220: $stmt = BasePeer::doSelect($criteria, $con);
1221: $results = array();
1222:
1223: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1224: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1225: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1226:
1227:
1228:
1229: } else {
1230: $cls = ContentAssocPeer::getOMClass();
1231:
1232: $obj1 = new $cls();
1233: $obj1->hydrate($row);
1234: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1235: }
1236:
1237:
1238:
1239: $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1240: if ($key2 !== null) {
1241: $obj2 = ProductPeer::getInstanceFromPool($key2);
1242: if (!$obj2) {
1243:
1244: $cls = ProductPeer::getOMClass();
1245:
1246: $obj2 = new $cls();
1247: $obj2->hydrate($row, $startcol2);
1248: ProductPeer::addInstanceToPool($obj2, $key2);
1249: }
1250:
1251:
1252: $obj2->addContentAssoc($obj1);
1253:
1254: }
1255:
1256:
1257:
1258: $key3 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1259: if ($key3 !== null) {
1260: $obj3 = ContentPeer::getInstanceFromPool($key3);
1261: if (!$obj3) {
1262:
1263: $cls = ContentPeer::getOMClass();
1264:
1265: $obj3 = new $cls();
1266: $obj3->hydrate($row, $startcol3);
1267: ContentPeer::addInstanceToPool($obj3, $key3);
1268: }
1269:
1270:
1271: $obj3->addContentAssoc($obj1);
1272:
1273: }
1274:
1275: $results[] = $obj1;
1276: }
1277: $stmt->closeCursor();
1278:
1279: return $results;
1280: }
1281:
1282:
1283: 1284: 1285: 1286: 1287: 1288: 1289: 1290: 1291: 1292:
1293: public static function doSelectJoinAllExceptProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1294: {
1295: $criteria = clone $criteria;
1296:
1297:
1298:
1299:
1300: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1301: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1302: }
1303:
1304: ContentAssocPeer::addSelectColumns($criteria);
1305: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1306:
1307: CategoryPeer::addSelectColumns($criteria);
1308: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1309:
1310: ContentPeer::addSelectColumns($criteria);
1311: $startcol4 = $startcol3 + ContentPeer::NUM_HYDRATE_COLUMNS;
1312:
1313: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1314:
1315: $criteria->addJoin(ContentAssocPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
1316:
1317:
1318: $stmt = BasePeer::doSelect($criteria, $con);
1319: $results = array();
1320:
1321: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1322: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1323: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1324:
1325:
1326:
1327: } else {
1328: $cls = ContentAssocPeer::getOMClass();
1329:
1330: $obj1 = new $cls();
1331: $obj1->hydrate($row);
1332: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1333: }
1334:
1335:
1336:
1337: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1338: if ($key2 !== null) {
1339: $obj2 = CategoryPeer::getInstanceFromPool($key2);
1340: if (!$obj2) {
1341:
1342: $cls = CategoryPeer::getOMClass();
1343:
1344: $obj2 = new $cls();
1345: $obj2->hydrate($row, $startcol2);
1346: CategoryPeer::addInstanceToPool($obj2, $key2);
1347: }
1348:
1349:
1350: $obj2->addContentAssoc($obj1);
1351:
1352: }
1353:
1354:
1355:
1356: $key3 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1357: if ($key3 !== null) {
1358: $obj3 = ContentPeer::getInstanceFromPool($key3);
1359: if (!$obj3) {
1360:
1361: $cls = ContentPeer::getOMClass();
1362:
1363: $obj3 = new $cls();
1364: $obj3->hydrate($row, $startcol3);
1365: ContentPeer::addInstanceToPool($obj3, $key3);
1366: }
1367:
1368:
1369: $obj3->addContentAssoc($obj1);
1370:
1371: }
1372:
1373: $results[] = $obj1;
1374: }
1375: $stmt->closeCursor();
1376:
1377: return $results;
1378: }
1379:
1380:
1381: 1382: 1383: 1384: 1385: 1386: 1387: 1388: 1389: 1390:
1391: public static function doSelectJoinAllExceptContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1392: {
1393: $criteria = clone $criteria;
1394:
1395:
1396:
1397:
1398: if ($criteria->getDbName() == Propel::getDefaultDB()) {
1399: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1400: }
1401:
1402: ContentAssocPeer::addSelectColumns($criteria);
1403: $startcol2 = ContentAssocPeer::NUM_HYDRATE_COLUMNS;
1404:
1405: CategoryPeer::addSelectColumns($criteria);
1406: $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
1407:
1408: ProductPeer::addSelectColumns($criteria);
1409: $startcol4 = $startcol3 + ProductPeer::NUM_HYDRATE_COLUMNS;
1410:
1411: $criteria->addJoin(ContentAssocPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
1412:
1413: $criteria->addJoin(ContentAssocPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
1414:
1415:
1416: $stmt = BasePeer::doSelect($criteria, $con);
1417: $results = array();
1418:
1419: while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1420: $key1 = ContentAssocPeer::getPrimaryKeyHashFromRow($row, 0);
1421: if (null !== ($obj1 = ContentAssocPeer::getInstanceFromPool($key1))) {
1422:
1423:
1424:
1425: } else {
1426: $cls = ContentAssocPeer::getOMClass();
1427:
1428: $obj1 = new $cls();
1429: $obj1->hydrate($row);
1430: ContentAssocPeer::addInstanceToPool($obj1, $key1);
1431: }
1432:
1433:
1434:
1435: $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1436: if ($key2 !== null) {
1437: $obj2 = CategoryPeer::getInstanceFromPool($key2);
1438: if (!$obj2) {
1439:
1440: $cls = CategoryPeer::getOMClass();
1441:
1442: $obj2 = new $cls();
1443: $obj2->hydrate($row, $startcol2);
1444: CategoryPeer::addInstanceToPool($obj2, $key2);
1445: }
1446:
1447:
1448: $obj2->addContentAssoc($obj1);
1449:
1450: }
1451:
1452:
1453:
1454: $key3 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1455: if ($key3 !== null) {
1456: $obj3 = ProductPeer::getInstanceFromPool($key3);
1457: if (!$obj3) {
1458:
1459: $cls = ProductPeer::getOMClass();
1460:
1461: $obj3 = new $cls();
1462: $obj3->hydrate($row, $startcol3);
1463: ProductPeer::addInstanceToPool($obj3, $key3);
1464: }
1465:
1466:
1467: $obj3->addContentAssoc($obj1);
1468:
1469: }
1470:
1471: $results[] = $obj1;
1472: }
1473: $stmt->closeCursor();
1474:
1475: return $results;
1476: }
1477:
1478: 1479: 1480: 1481: 1482: 1483: 1484:
1485: public static function getTableMap()
1486: {
1487: return Propel::getDatabaseMap(ContentAssocPeer::DATABASE_NAME)->getTable(ContentAssocPeer::TABLE_NAME);
1488: }
1489:
1490: 1491: 1492:
1493: public static function buildTableMap()
1494: {
1495: $dbMap = Propel::getDatabaseMap(BaseContentAssocPeer::DATABASE_NAME);
1496: if (!$dbMap->hasTable(BaseContentAssocPeer::TABLE_NAME)) {
1497: $dbMap->addTableObject(new ContentAssocTableMap());
1498: }
1499: }
1500:
1501: 1502: 1503: 1504: 1505: 1506:
1507: public static function getOMClass($row = 0, $colnum = 0)
1508: {
1509: return ContentAssocPeer::OM_CLASS;
1510: }
1511:
1512: 1513: 1514: 1515: 1516: 1517: 1518: 1519: 1520:
1521: public static function doInsert($values, PropelPDO $con = null)
1522: {
1523: if ($con === null) {
1524: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1525: }
1526:
1527: if ($values instanceof Criteria) {
1528: $criteria = clone $values;
1529: } else {
1530: $criteria = $values->buildCriteria();
1531: }
1532:
1533: if ($criteria->containsKey(ContentAssocPeer::ID) && $criteria->keyContainsValue(ContentAssocPeer::ID) ) {
1534: throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentAssocPeer::ID.')');
1535: }
1536:
1537:
1538:
1539: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1540:
1541: try {
1542:
1543:
1544: $con->beginTransaction();
1545: $pk = BasePeer::doInsert($criteria, $con);
1546: $con->commit();
1547: } catch (PropelException $e) {
1548: $con->rollBack();
1549: throw $e;
1550: }
1551:
1552: return $pk;
1553: }
1554:
1555: 1556: 1557: 1558: 1559: 1560: 1561: 1562: 1563:
1564: public static function doUpdate($values, PropelPDO $con = null)
1565: {
1566: if ($con === null) {
1567: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1568: }
1569:
1570: $selectCriteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1571:
1572: if ($values instanceof Criteria) {
1573: $criteria = clone $values;
1574:
1575: $comparison = $criteria->getComparison(ContentAssocPeer::ID);
1576: $value = $criteria->remove(ContentAssocPeer::ID);
1577: if ($value) {
1578: $selectCriteria->add(ContentAssocPeer::ID, $value, $comparison);
1579: } else {
1580: $selectCriteria->setPrimaryTableName(ContentAssocPeer::TABLE_NAME);
1581: }
1582:
1583: } else {
1584: $criteria = $values->buildCriteria();
1585: $selectCriteria = $values->buildPkeyCriteria();
1586: }
1587:
1588:
1589: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1590:
1591: return BasePeer::doUpdate($selectCriteria, $criteria, $con);
1592: }
1593:
1594: 1595: 1596: 1597: 1598: 1599: 1600:
1601: public static function doDeleteAll(PropelPDO $con = null)
1602: {
1603: if ($con === null) {
1604: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1605: }
1606: $affectedRows = 0;
1607: try {
1608:
1609:
1610: $con->beginTransaction();
1611: $affectedRows += BasePeer::doDeleteAll(ContentAssocPeer::TABLE_NAME, $con, ContentAssocPeer::DATABASE_NAME);
1612:
1613:
1614:
1615: ContentAssocPeer::clearInstancePool();
1616: ContentAssocPeer::clearRelatedInstancePool();
1617: $con->commit();
1618:
1619: return $affectedRows;
1620: } catch (PropelException $e) {
1621: $con->rollBack();
1622: throw $e;
1623: }
1624: }
1625:
1626: 1627: 1628: 1629: 1630: 1631: 1632: 1633: 1634: 1635: 1636:
1637: public static function doDelete($values, PropelPDO $con = null)
1638: {
1639: if ($con === null) {
1640: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1641: }
1642:
1643: if ($values instanceof Criteria) {
1644:
1645:
1646:
1647: ContentAssocPeer::clearInstancePool();
1648:
1649: $criteria = clone $values;
1650: } elseif ($values instanceof ContentAssoc) {
1651:
1652: ContentAssocPeer::removeInstanceFromPool($values);
1653:
1654: $criteria = $values->buildPkeyCriteria();
1655: } else {
1656: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1657: $criteria->add(ContentAssocPeer::ID, (array) $values, Criteria::IN);
1658:
1659: foreach ((array) $values as $singleval) {
1660: ContentAssocPeer::removeInstanceFromPool($singleval);
1661: }
1662: }
1663:
1664:
1665: $criteria->setDbName(ContentAssocPeer::DATABASE_NAME);
1666:
1667: $affectedRows = 0;
1668:
1669: try {
1670:
1671:
1672: $con->beginTransaction();
1673:
1674: $affectedRows += BasePeer::doDelete($criteria, $con);
1675: ContentAssocPeer::clearRelatedInstancePool();
1676: $con->commit();
1677:
1678: return $affectedRows;
1679: } catch (PropelException $e) {
1680: $con->rollBack();
1681: throw $e;
1682: }
1683: }
1684:
1685: 1686: 1687: 1688: 1689: 1690: 1691: 1692: 1693: 1694: 1695: 1696:
1697: public static function doValidate($obj, $cols = null)
1698: {
1699: $columns = array();
1700:
1701: if ($cols) {
1702: $dbMap = Propel::getDatabaseMap(ContentAssocPeer::DATABASE_NAME);
1703: $tableMap = $dbMap->getTable(ContentAssocPeer::TABLE_NAME);
1704:
1705: if (! is_array($cols)) {
1706: $cols = array($cols);
1707: }
1708:
1709: foreach ($cols as $colName) {
1710: if ($tableMap->hasColumn($colName)) {
1711: $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
1712: $columns[$colName] = $obj->$get();
1713: }
1714: }
1715: } else {
1716:
1717: }
1718:
1719: return BasePeer::doValidate(ContentAssocPeer::DATABASE_NAME, ContentAssocPeer::TABLE_NAME, $columns);
1720: }
1721:
1722: 1723: 1724: 1725: 1726: 1727: 1728:
1729: public static function retrieveByPK($pk, PropelPDO $con = null)
1730: {
1731:
1732: if (null !== ($obj = ContentAssocPeer::getInstanceFromPool((string) $pk))) {
1733: return $obj;
1734: }
1735:
1736: if ($con === null) {
1737: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1738: }
1739:
1740: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1741: $criteria->add(ContentAssocPeer::ID, $pk);
1742:
1743: $v = ContentAssocPeer::doSelect($criteria, $con);
1744:
1745: return !empty($v) > 0 ? $v[0] : null;
1746: }
1747:
1748: 1749: 1750: 1751: 1752: 1753: 1754: 1755: 1756:
1757: public static function retrieveByPKs($pks, PropelPDO $con = null)
1758: {
1759: if ($con === null) {
1760: $con = Propel::getConnection(ContentAssocPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1761: }
1762:
1763: $objs = null;
1764: if (empty($pks)) {
1765: $objs = array();
1766: } else {
1767: $criteria = new Criteria(ContentAssocPeer::DATABASE_NAME);
1768: $criteria->add(ContentAssocPeer::ID, $pks, Criteria::IN);
1769: $objs = ContentAssocPeer::doSelect($criteria, $con);
1770: }
1771:
1772: return $objs;
1773: }
1774:
1775: }
1776:
1777:
1778:
1779: BaseContentAssocPeer::buildTableMap();
1780:
1781: