1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567 |
- <?php
- /**
- * Base static class for performing query and update operations on the 'katao_cart' table.
- *
- *
- *
- * @package lib.model.om
- */
- abstract class BaseKataoCartPeer {
- /** the default database name for this class */
- const DATABASE_NAME = 'propel';
- /** the table name for this class */
- const TABLE_NAME = 'katao_cart';
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'lib.model.KataoCart';
- /** The total number of columns. */
- const NUM_COLUMNS = 7;
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
- /** the column name for the ID field */
- const ID = 'katao_cart.ID';
- /** the column name for the KATAO_USER_ID field */
- const KATAO_USER_ID = 'katao_cart.KATAO_USER_ID';
- /** the column name for the KATAO_PERIOD_ID field */
- const KATAO_PERIOD_ID = 'katao_cart.KATAO_PERIOD_ID';
- /** the column name for the KATAO_NODE_ID field */
- const KATAO_NODE_ID = 'katao_cart.KATAO_NODE_ID';
- /** the column name for the STATUS field */
- const STATUS = 'katao_cart.STATUS';
- /** the column name for the CREATED_AT field */
- const CREATED_AT = 'katao_cart.CREATED_AT';
- /** the column name for the UPDATED_AT field */
- const UPDATED_AT = 'katao_cart.UPDATED_AT';
- /** The PHP to DB Name Mapping */
- private static $phpNameMap = null;
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'KataoUserId', 'KataoPeriodId', 'KataoNodeId', 'Status', 'CreatedAt', 'UpdatedAt', ),
- BasePeer::TYPE_COLNAME => array (KataoCartPeer::ID, KataoCartPeer::KATAO_USER_ID, KataoCartPeer::KATAO_PERIOD_ID, KataoCartPeer::KATAO_NODE_ID, KataoCartPeer::STATUS, KataoCartPeer::CREATED_AT, KataoCartPeer::UPDATED_AT, ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'katao_user_id', 'katao_period_id', 'katao_node_id', 'status', 'created_at', 'updated_at', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
- );
- /**
- * holds an array of keys for quick access to the fieldnames array
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
- */
- private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'KataoUserId' => 1, 'KataoPeriodId' => 2, 'KataoNodeId' => 3, 'Status' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- BasePeer::TYPE_COLNAME => array (KataoCartPeer::ID => 0, KataoCartPeer::KATAO_USER_ID => 1, KataoCartPeer::KATAO_PERIOD_ID => 2, KataoCartPeer::KATAO_NODE_ID => 3, KataoCartPeer::STATUS => 4, KataoCartPeer::CREATED_AT => 5, KataoCartPeer::UPDATED_AT => 6, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'katao_user_id' => 1, 'katao_period_id' => 2, 'katao_node_id' => 3, 'status' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
- );
- /**
- * @return MapBuilder the map builder for this peer
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function getMapBuilder()
- {
- return BasePeer::getMapBuilder('lib.model.map.KataoCartMapBuilder');
- }
- /**
- * Gets a map (hash) of PHP names to DB column names.
- *
- * @return array The PHP to DB name map for this peer
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
- */
- public static function getPhpNameMap()
- {
- if (self::$phpNameMap === null) {
- $map = KataoCartPeer::getTableMap();
- $columns = $map->getColumns();
- $nameMap = array();
- foreach ($columns as $column) {
- $nameMap[$column->getPhpName()] = $column->getColumnName();
- }
- self::$phpNameMap = $nameMap;
- }
- return self::$phpNameMap;
- }
- /**
- * Translates a fieldname to another type
- *
- * @param string $name field name
- * @param string $fromType One of the class type constants TYPE_PHPNAME,
- * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
- * @param string $toType One of the class type constants
- * @return string translated name of the field.
- */
- static public function translateFieldName($name, $fromType, $toType)
- {
- $toNames = self::getFieldNames($toType);
- $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
- if ($key === null) {
- throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
- }
- return $toNames[$key];
- }
- /**
- * Returns an array of of field names.
- *
- * @param string $type The type of fieldnames to return:
- * One of the class type constants TYPE_PHPNAME,
- * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
- * @return array A list of field names
- */
- static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
- {
- if (!array_key_exists($type, self::$fieldNames)) {
- throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
- }
- return self::$fieldNames[$type];
- }
- /**
- * Convenience method which changes table.column to alias.column.
- *
- * Using this method you can maintain SQL abstraction while using column aliases.
- * <code>
- * $c->addAlias("alias1", TablePeer::TABLE_NAME);
- * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
- * </code>
- * @param string $alias The alias for the current table.
- * @param string $column The column name for current table. (i.e. KataoCartPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(KataoCartPeer::TABLE_NAME.'.', $alias.'.', $column);
- }
- /**
- * Add all the columns needed to create a new object.
- *
- * Note: any columns that were marked with lazyLoad="true" in the
- * XML schema will not be added to the select list and only loaded
- * on demand.
- *
- * @param criteria object containing the columns to add.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function addSelectColumns(Criteria $criteria)
- {
- $criteria->addSelectColumn(KataoCartPeer::ID);
- $criteria->addSelectColumn(KataoCartPeer::KATAO_USER_ID);
- $criteria->addSelectColumn(KataoCartPeer::KATAO_PERIOD_ID);
- $criteria->addSelectColumn(KataoCartPeer::KATAO_NODE_ID);
- $criteria->addSelectColumn(KataoCartPeer::STATUS);
- $criteria->addSelectColumn(KataoCartPeer::CREATED_AT);
- $criteria->addSelectColumn(KataoCartPeer::UPDATED_AT);
- }
- const COUNT = 'COUNT(katao_cart.ID)';
- const COUNT_DISTINCT = 'COUNT(DISTINCT katao_cart.ID)';
- /**
- * Returns the number of rows matching criteria.
- *
- * @param Criteria $criteria
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCount(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Method to select one object from the DB.
- *
- * @param Criteria $criteria object used to create the SELECT statement.
- * @param Connection $con
- * @return KataoCart
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectOne(Criteria $criteria, $con = null)
- {
- $critcopy = clone $criteria;
- $critcopy->setLimit(1);
- $objects = KataoCartPeer::doSelect($critcopy, $con);
- if ($objects) {
- return $objects[0];
- }
- return null;
- }
- /**
- * Method to do selects.
- *
- * @param Criteria $criteria The Criteria object used to build the SELECT statement.
- * @param Connection $con
- * @return array Array of selected Objects
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelect(Criteria $criteria, $con = null)
- {
- return KataoCartPeer::populateObjects(KataoCartPeer::doSelectRS($criteria, $con));
- }
- /**
- * Prepares the Criteria object and uses the parent doSelect()
- * method to get a ResultSet.
- *
- * Use this method directly if you want to just get the resultset
- * (instead of an array of objects).
- *
- * @param Criteria $criteria The Criteria object used to build the SELECT statement.
- * @param Connection $con the connection to use
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- * @return ResultSet The resultset object with numerically-indexed fields.
- * @see BasePeer::doSelect()
- */
- public static function doSelectRS(Criteria $criteria, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectRS:doSelectRS') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $criteria, $con);
- }
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- if (!$criteria->getSelectColumns()) {
- $criteria = clone $criteria;
- KataoCartPeer::addSelectColumns($criteria);
- }
- // Set the correct dbName
- $criteria->setDbName(self::DATABASE_NAME);
- // BasePeer returns a Creole ResultSet, set to return
- // rows indexed numerically.
- return BasePeer::doSelect($criteria, $con);
- }
- /**
- * The returned array will contain objects of the default type or
- * objects that inherit from the default.
- *
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function populateObjects(ResultSet $rs)
- {
- $results = array();
-
- // set the class once to avoid overhead in the loop
- $cls = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($cls);
- // populate the object(s)
- while($rs->next()) {
-
- $obj = new $cls();
- $obj->hydrate($rs);
- $results[] = $obj;
-
- }
- return $results;
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoUser table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinKataoUser(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoPeriod table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinKataoPeriod(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoNode table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinKataoNode(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with their KataoUser objects.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinKataoUser(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoin:doSelectJoin') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoUserPeer::addSelectColumns($c);
- $c->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoUserPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol);
- $newObject = true;
- foreach($results as $temp_obj1) {
- $temp_obj2 = $temp_obj1->getKataoUser(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- // e.g. $author->addBookRelatedByBookId()
- $temp_obj2->addKataoCart($obj1); //CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1); //CHECKME
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with their KataoPeriod objects.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinKataoPeriod(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoin:doSelectJoin') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoPeriodPeer::addSelectColumns($c);
- $c->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoPeriodPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol);
- $newObject = true;
- foreach($results as $temp_obj1) {
- $temp_obj2 = $temp_obj1->getKataoPeriod(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- // e.g. $author->addBookRelatedByBookId()
- $temp_obj2->addKataoCart($obj1); //CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1); //CHECKME
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with their KataoNode objects.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinKataoNode(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoin:doSelectJoin') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoNodePeer::addSelectColumns($c);
- $c->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoNodePeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol);
- $newObject = true;
- foreach($results as $temp_obj1) {
- $temp_obj2 = $temp_obj1->getKataoNode(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- // e.g. $author->addBookRelatedByBookId()
- $temp_obj2->addKataoCart($obj1); //CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1); //CHECKME
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Returns the number of rows matching criteria, joining all related tables
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
- {
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $criteria->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $criteria->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with all related objects.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAll(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol2 = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoUserPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + KataoUserPeer::NUM_COLUMNS;
- KataoPeriodPeer::addSelectColumns($c);
- $startcol4 = $startcol3 + KataoPeriodPeer::NUM_COLUMNS;
- KataoNodePeer::addSelectColumns($c);
- $startcol5 = $startcol4 + KataoNodePeer::NUM_COLUMNS;
- $c->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $c->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $c->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- // Add objects for joined KataoUser rows
-
- $omClass = KataoUserPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol2);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getKataoUser(); // CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- $temp_obj2->addKataoCart($obj1); // CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1);
- }
- // Add objects for joined KataoPeriod rows
-
- $omClass = KataoPeriodPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj3 = new $cls();
- $obj3->hydrate($rs, $startcol3);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj3 = $temp_obj1->getKataoPeriod(); // CHECKME
- if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
- $newObject = false;
- $temp_obj3->addKataoCart($obj1); // CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj3->initKataoCarts();
- $obj3->addKataoCart($obj1);
- }
- // Add objects for joined KataoNode rows
-
- $omClass = KataoNodePeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj4 = new $cls();
- $obj4->hydrate($rs, $startcol4);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj4 = $temp_obj1->getKataoNode(); // CHECKME
- if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
- $newObject = false;
- $temp_obj4->addKataoCart($obj1); // CHECKME
- break;
- }
- }
- if ($newObject) {
- $obj4->initKataoCarts();
- $obj4->addKataoCart($obj1);
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoUser table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinAllExceptKataoUser(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $criteria->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoPeriod table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinAllExceptKataoPeriod(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $criteria->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Returns the number of rows matching criteria, joining the related KataoNode table
- *
- * @param Criteria $c
- * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
- * @param Connection $con
- * @return int Number of matching rows.
- */
- public static function doCountJoinAllExceptKataoNode(Criteria $criteria, $distinct = false, $con = null)
- {
- // we're going to modify criteria, so copy it first
- $criteria = clone $criteria;
- // clear out anything that might confuse the ORDER BY clause
- $criteria->clearSelectColumns()->clearOrderByColumns();
- if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->addSelectColumn(KataoCartPeer::COUNT_DISTINCT);
- } else {
- $criteria->addSelectColumn(KataoCartPeer::COUNT);
- }
- // just in case we're grouping: add those columns to the select statement
- foreach($criteria->getGroupByColumns() as $column)
- {
- $criteria->addSelectColumn($column);
- }
- $criteria->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $criteria->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $rs = KataoCartPeer::doSelectRS($criteria, $con);
- if ($rs->next()) {
- return $rs->getInt(1);
- } else {
- // no rows returned; we infer that means 0 matches.
- return 0;
- }
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with all related objects except KataoUser.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptKataoUser(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- // $c->getDbName() will return the same object if not set to another value
- // so == check is okay and faster
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol2 = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoPeriodPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + KataoPeriodPeer::NUM_COLUMNS;
- KataoNodePeer::addSelectColumns($c);
- $startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;
- $c->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $c->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoPeriodPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol2);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getKataoPeriod(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- $temp_obj2->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1);
- }
- $omClass = KataoNodePeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj3 = new $cls();
- $obj3->hydrate($rs, $startcol3);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj3 = $temp_obj1->getKataoNode(); //CHECKME
- if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
- $newObject = false;
- $temp_obj3->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj3->initKataoCarts();
- $obj3->addKataoCart($obj1);
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with all related objects except KataoPeriod.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptKataoPeriod(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- // $c->getDbName() will return the same object if not set to another value
- // so == check is okay and faster
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol2 = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoUserPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + KataoUserPeer::NUM_COLUMNS;
- KataoNodePeer::addSelectColumns($c);
- $startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;
- $c->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $c->addJoin(KataoCartPeer::KATAO_NODE_ID, KataoNodePeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoUserPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol2);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getKataoUser(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- $temp_obj2->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1);
- }
- $omClass = KataoNodePeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj3 = new $cls();
- $obj3->hydrate($rs, $startcol3);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj3 = $temp_obj1->getKataoNode(); //CHECKME
- if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
- $newObject = false;
- $temp_obj3->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj3->initKataoCarts();
- $obj3->addKataoCart($obj1);
- }
- $results[] = $obj1;
- }
- return $results;
- }
- /**
- * Selects a collection of KataoCart objects pre-filled with all related objects except KataoNode.
- *
- * @return array Array of KataoCart objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptKataoNode(Criteria $c, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $c, $con);
- }
- $c = clone $c;
- // Set the correct dbName if it has not been overridden
- // $c->getDbName() will return the same object if not set to another value
- // so == check is okay and faster
- if ($c->getDbName() == Propel::getDefaultDB()) {
- $c->setDbName(self::DATABASE_NAME);
- }
- KataoCartPeer::addSelectColumns($c);
- $startcol2 = (KataoCartPeer::NUM_COLUMNS - KataoCartPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- KataoUserPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + KataoUserPeer::NUM_COLUMNS;
- KataoPeriodPeer::addSelectColumns($c);
- $startcol4 = $startcol3 + KataoPeriodPeer::NUM_COLUMNS;
- $c->addJoin(KataoCartPeer::KATAO_USER_ID, KataoUserPeer::ID);
- $c->addJoin(KataoCartPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
- $rs = BasePeer::doSelect($c, $con);
- $results = array();
- while($rs->next()) {
- $omClass = KataoCartPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj1 = new $cls();
- $obj1->hydrate($rs);
- $omClass = KataoUserPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj2 = new $cls();
- $obj2->hydrate($rs, $startcol2);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getKataoUser(); //CHECKME
- if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
- $newObject = false;
- $temp_obj2->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj2->initKataoCarts();
- $obj2->addKataoCart($obj1);
- }
- $omClass = KataoPeriodPeer::getOMClass();
- $cls = sfPropel::import($omClass);
- $obj3 = new $cls();
- $obj3->hydrate($rs, $startcol3);
- $newObject = true;
- for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
- $temp_obj1 = $results[$j];
- $temp_obj3 = $temp_obj1->getKataoPeriod(); //CHECKME
- if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
- $newObject = false;
- $temp_obj3->addKataoCart($obj1);
- break;
- }
- }
- if ($newObject) {
- $obj3->initKataoCarts();
- $obj3->addKataoCart($obj1);
- }
- $results[] = $obj1;
- }
- return $results;
- }
- static public function getUniqueColumnNames()
- {
- return array();
- }
- /**
- * Returns the TableMap related to this peer.
- * This method is not needed for general use but a specific application could have a need.
- * @return TableMap
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function getTableMap()
- {
- return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
- }
- /**
- * The class that the Peer will make instances of.
- *
- * This uses a dot-path notation which is tranalted into a path
- * relative to a location on the PHP include_path.
- * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
- *
- * @return string path.to.ClassName
- */
- public static function getOMClass()
- {
- return KataoCartPeer::CLASS_DEFAULT;
- }
- /**
- * Method perform an INSERT on the database, given a KataoCart or Criteria object.
- *
- * @param mixed $values Criteria or KataoCart object containing data that is used to create the INSERT statement.
- * @param Connection $con the connection to use
- * @return mixed The new primary key.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doInsert($values, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doInsert:pre') as $callable)
- {
- $ret = call_user_func($callable, 'BaseKataoCartPeer', $values, $con);
- if (false !== $ret)
- {
- return $ret;
- }
- }
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from KataoCart object
- }
- $criteria->remove(KataoCartPeer::ID); // remove pkey col since this table uses auto-increment
- // Set the correct dbName
- $criteria->setDbName(self::DATABASE_NAME);
- try {
- // use transaction because $criteria could contain info
- // for more than one table (I guess, conceivably)
- $con->begin();
- $pk = BasePeer::doInsert($criteria, $con);
- $con->commit();
- } catch(PropelException $e) {
- $con->rollback();
- throw $e;
- }
-
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doInsert:post') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $values, $con, $pk);
- }
- return $pk;
- }
- /**
- * Method perform an UPDATE on the database, given a KataoCart or Criteria object.
- *
- * @param mixed $values Criteria or KataoCart object containing data that is used to create the UPDATE statement.
- * @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
- * @return int The number of affected rows (if supported by underlying database driver).
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doUpdate($values, $con = null)
- {
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doUpdate:pre') as $callable)
- {
- $ret = call_user_func($callable, 'BaseKataoCartPeer', $values, $con);
- if (false !== $ret)
- {
- return $ret;
- }
- }
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- $selectCriteria = new Criteria(self::DATABASE_NAME);
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- $comparison = $criteria->getComparison(KataoCartPeer::ID);
- $selectCriteria->add(KataoCartPeer::ID, $criteria->remove(KataoCartPeer::ID), $comparison);
- } else { // $values is KataoCart object
- $criteria = $values->buildCriteria(); // gets full criteria
- $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
- }
- // set the correct dbName
- $criteria->setDbName(self::DATABASE_NAME);
- $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
-
- foreach (sfMixer::getCallables('BaseKataoCartPeer:doUpdate:post') as $callable)
- {
- call_user_func($callable, 'BaseKataoCartPeer', $values, $con, $ret);
- }
- return $ret;
- }
- /**
- * Method to DELETE all rows from the katao_cart table.
- *
- * @return int The number of affected rows (if supported by underlying database driver).
- */
- public static function doDeleteAll($con = null)
- {
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- $affectedRows = 0; // initialize var to track total num of affected rows
- try {
- // use transaction because $criteria could contain info
- // for more than one table or we could emulating ON DELETE CASCADE, etc.
- $con->begin();
- $affectedRows += BasePeer::doDeleteAll(KataoCartPeer::TABLE_NAME, $con);
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollback();
- throw $e;
- }
- }
- /**
- * Method perform a DELETE on the database, given a KataoCart or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or KataoCart object or primary key or array of primary keys
- * which is used to create the DELETE statement
- * @param Connection $con the connection to use
- * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
- * if supported by native driver or if emulated using Propel.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doDelete($values, $con = null)
- {
- if ($con === null) {
- $con = Propel::getConnection(KataoCartPeer::DATABASE_NAME);
- }
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } elseif ($values instanceof KataoCart) {
- $criteria = $values->buildPkeyCriteria();
- } else {
- // it must be the primary key
- $criteria = new Criteria(self::DATABASE_NAME);
- $criteria->add(KataoCartPeer::ID, (array) $values, Criteria::IN);
- }
- // Set the correct dbName
- $criteria->setDbName(self::DATABASE_NAME);
- $affectedRows = 0; // initialize var to track total num of affected rows
- try {
- // use transaction because $criteria could contain info
- // for more than one table or we could emulating ON DELETE CASCADE, etc.
- $con->begin();
-
- $affectedRows += BasePeer::doDelete($criteria, $con);
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollback();
- throw $e;
- }
- }
- /**
- * Validates all modified columns of given KataoCart object.
- * If parameter $columns is either a single column name or an array of column names
- * than only those columns are validated.
- *
- * NOTICE: This does not apply to primary or foreign keys for now.
- *
- * @param KataoCart $obj The object to validate.
- * @param mixed $cols Column name or array of column names.
- *
- * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
- */
- public static function doValidate(KataoCart $obj, $cols = null)
- {
- $columns = array();
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(KataoCartPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(KataoCartPeer::TABLE_NAME);
- if (! is_array($cols)) {
- $cols = array($cols);
- }
- foreach($cols as $colName) {
- if ($tableMap->containsColumn($colName)) {
- $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
- $columns[$colName] = $obj->$get();
- }
- }
- } else {
- }
- $res = BasePeer::doValidate(KataoCartPeer::DATABASE_NAME, KataoCartPeer::TABLE_NAME, $columns);
- if ($res !== true) {
- $request = sfContext::getInstance()->getRequest();
- foreach ($res as $failed) {
- $col = KataoCartPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
- $request->setError($col, $failed->getMessage());
- }
- }
- return $res;
- }
- /**
- * Retrieve a single object by pkey.
- *
- * @param mixed $pk the primary key.
- * @param Connection $con the connection to use
- * @return KataoCart
- */
- public static function retrieveByPK($pk, $con = null)
- {
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- $criteria = new Criteria(KataoCartPeer::DATABASE_NAME);
- $criteria->add(KataoCartPeer::ID, $pk);
- $v = KataoCartPeer::doSelect($criteria, $con);
- return !empty($v) > 0 ? $v[0] : null;
- }
- /**
- * Retrieve multiple objects by pkey.
- *
- * @param array $pks List of primary keys
- * @param Connection $con the connection to use
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function retrieveByPKs($pks, $con = null)
- {
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria();
- $criteria->add(KataoCartPeer::ID, $pks, Criteria::IN);
- $objs = KataoCartPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
- } // BaseKataoCartPeer
- // static code to register the map builder for this Peer with the main Propel class
- if (Propel::isInit()) {
- // the MapBuilder classes register themselves with Propel during initialization
- // so we need to load them here.
- try {
- BaseKataoCartPeer::getMapBuilder();
- } catch (Exception $e) {
- Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
- }
- } else {
- // even if Propel is not yet initialized, the map builder class can be registered
- // now and then it will be loaded when Propel initializes.
- Propel::registerMapBuilder('lib.model.map.KataoCartMapBuilder');
- }
|