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