Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
  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\Admin;
 13: use Thelia\Model\AdminGroupPeer;
 14: use Thelia\Model\AdminPeer;
 15: use Thelia\Model\map\AdminTableMap;
 16: 
 17: /**
 18:  * Base static class for performing query and update operations on the 'admin' table.
 19:  *
 20:  *
 21:  *
 22:  * @package propel.generator.Thelia.Model.om
 23:  */
 24: abstract class BaseAdminPeer
 25: {
 26: 
 27:     /** the default database name for this class */
 28:     const DATABASE_NAME = 'thelia';
 29: 
 30:     /** the table name for this class */
 31:     const TABLE_NAME = 'admin';
 32: 
 33:     /** the related Propel class for this table */
 34:     const OM_CLASS = 'Thelia\\Model\\Admin';
 35: 
 36:     /** the related TableMap class for this table */
 37:     const TM_CLASS = 'AdminTableMap';
 38: 
 39:     /** The total number of columns. */
 40:     const NUM_COLUMNS = 9;
 41: 
 42:     /** The number of lazy-loaded columns. */
 43:     const NUM_LAZY_LOAD_COLUMNS = 0;
 44: 
 45:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
 46:     const NUM_HYDRATE_COLUMNS = 9;
 47: 
 48:     /** the column name for the ID field */
 49:     const ID = 'admin.ID';
 50: 
 51:     /** the column name for the FIRSTNAME field */
 52:     const FIRSTNAME = 'admin.FIRSTNAME';
 53: 
 54:     /** the column name for the LASTNAME field */
 55:     const LASTNAME = 'admin.LASTNAME';
 56: 
 57:     /** the column name for the LOGIN field */
 58:     const LOGIN = 'admin.LOGIN';
 59: 
 60:     /** the column name for the PASSWORD field */
 61:     const PASSWORD = 'admin.PASSWORD';
 62: 
 63:     /** the column name for the ALGO field */
 64:     const ALGO = 'admin.ALGO';
 65: 
 66:     /** the column name for the SALT field */
 67:     const SALT = 'admin.SALT';
 68: 
 69:     /** the column name for the CREATED_AT field */
 70:     const CREATED_AT = 'admin.CREATED_AT';
 71: 
 72:     /** the column name for the UPDATED_AT field */
 73:     const UPDATED_AT = 'admin.UPDATED_AT';
 74: 
 75:     /** The default string format for model objects of the related table **/
 76:     const DEFAULT_STRING_FORMAT = 'YAML';
 77: 
 78:     /**
 79:      * An identiy map to hold any loaded instances of Admin objects.
 80:      * This must be public so that other peer classes can access this when hydrating from JOIN
 81:      * queries.
 82:      * @var        array Admin[]
 83:      */
 84:     public static $instances = array();
 85: 
 86: 
 87:     /**
 88:      * holds an array of fieldnames
 89:      *
 90:      * first dimension keys are the type constants
 91:      * e.g. AdminPeer::$fieldNames[AdminPeer::TYPE_PHPNAME][0] = 'Id'
 92:      */
 93:     protected static $fieldNames = array (
 94:         BasePeer::TYPE_PHPNAME => array ('Id', 'Firstname', 'Lastname', 'Login', 'Password', 'Algo', 'Salt', 'CreatedAt', 'UpdatedAt', ),
 95:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'createdAt', 'updatedAt', ),
 96:         BasePeer::TYPE_COLNAME => array (AdminPeer::ID, AdminPeer::FIRSTNAME, AdminPeer::LASTNAME, AdminPeer::LOGIN, AdminPeer::PASSWORD, AdminPeer::ALGO, AdminPeer::SALT, AdminPeer::CREATED_AT, AdminPeer::UPDATED_AT, ),
 97:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRSTNAME', 'LASTNAME', 'LOGIN', 'PASSWORD', 'ALGO', 'SALT', 'CREATED_AT', 'UPDATED_AT', ),
 98:         BasePeer::TYPE_FIELDNAME => array ('id', 'firstname', 'lastname', 'login', 'password', 'algo', 'salt', 'created_at', 'updated_at', ),
 99:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
100:     );
101: 
102:     /**
103:      * holds an array of keys for quick access to the fieldnames array
104:      *
105:      * first dimension keys are the type constants
106:      * e.g. AdminPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
107:      */
108:     protected static $fieldKeys = array (
109:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Firstname' => 1, 'Lastname' => 2, 'Login' => 3, 'Password' => 4, 'Algo' => 5, 'Salt' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
110:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
111:         BasePeer::TYPE_COLNAME => array (AdminPeer::ID => 0, AdminPeer::FIRSTNAME => 1, AdminPeer::LASTNAME => 2, AdminPeer::LOGIN => 3, AdminPeer::PASSWORD => 4, AdminPeer::ALGO => 5, AdminPeer::SALT => 6, AdminPeer::CREATED_AT => 7, AdminPeer::UPDATED_AT => 8, ),
112:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRSTNAME' => 1, 'LASTNAME' => 2, 'LOGIN' => 3, 'PASSWORD' => 4, 'ALGO' => 5, 'SALT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
113:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'firstname' => 1, 'lastname' => 2, 'login' => 3, 'password' => 4, 'algo' => 5, 'salt' => 6, 'created_at' => 7, 'updated_at' => 8, ),
114:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
115:     );
116: 
117:     /**
118:      * Translates a fieldname to another type
119:      *
120:      * @param      string $name field name
121:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
122:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
123:      * @param      string $toType   One of the class type constants
124:      * @return string          translated name of the field.
125:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
126:      */
127:     public static function translateFieldName($name, $fromType, $toType)
128:     {
129:         $toNames = AdminPeer::getFieldNames($toType);
130:         $key = isset(AdminPeer::$fieldKeys[$fromType][$name]) ? AdminPeer::$fieldKeys[$fromType][$name] : null;
131:         if ($key === null) {
132:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AdminPeer::$fieldKeys[$fromType], true));
133:         }
134: 
135:         return $toNames[$key];
136:     }
137: 
138:     /**
139:      * Returns an array of field names.
140:      *
141:      * @param      string $type The type of fieldnames to return:
142:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
143:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
144:      * @return array           A list of field names
145:      * @throws PropelException - if the type is not valid.
146:      */
147:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
148:     {
149:         if (!array_key_exists($type, AdminPeer::$fieldNames)) {
150:             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.');
151:         }
152: 
153:         return AdminPeer::$fieldNames[$type];
154:     }
155: 
156:     /**
157:      * Convenience method which changes table.column to alias.column.
158:      *
159:      * Using this method you can maintain SQL abstraction while using column aliases.
160:      * <code>
161:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
162:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
163:      * </code>
164:      * @param      string $alias The alias for the current table.
165:      * @param      string $column The column name for current table. (i.e. AdminPeer::COLUMN_NAME).
166:      * @return string
167:      */
168:     public static function alias($alias, $column)
169:     {
170:         return str_replace(AdminPeer::TABLE_NAME.'.', $alias.'.', $column);
171:     }
172: 
173:     /**
174:      * Add all the columns needed to create a new object.
175:      *
176:      * Note: any columns that were marked with lazyLoad="true" in the
177:      * XML schema will not be added to the select list and only loaded
178:      * on demand.
179:      *
180:      * @param      Criteria $criteria object containing the columns to add.
181:      * @param      string   $alias    optional table alias
182:      * @throws PropelException Any exceptions caught during processing will be
183:      *       rethrown wrapped into a PropelException.
184:      */
185:     public static function addSelectColumns(Criteria $criteria, $alias = null)
186:     {
187:         if (null === $alias) {
188:             $criteria->addSelectColumn(AdminPeer::ID);
189:             $criteria->addSelectColumn(AdminPeer::FIRSTNAME);
190:             $criteria->addSelectColumn(AdminPeer::LASTNAME);
191:             $criteria->addSelectColumn(AdminPeer::LOGIN);
192:             $criteria->addSelectColumn(AdminPeer::PASSWORD);
193:             $criteria->addSelectColumn(AdminPeer::ALGO);
194:             $criteria->addSelectColumn(AdminPeer::SALT);
195:             $criteria->addSelectColumn(AdminPeer::CREATED_AT);
196:             $criteria->addSelectColumn(AdminPeer::UPDATED_AT);
197:         } else {
198:             $criteria->addSelectColumn($alias . '.ID');
199:             $criteria->addSelectColumn($alias . '.FIRSTNAME');
200:             $criteria->addSelectColumn($alias . '.LASTNAME');
201:             $criteria->addSelectColumn($alias . '.LOGIN');
202:             $criteria->addSelectColumn($alias . '.PASSWORD');
203:             $criteria->addSelectColumn($alias . '.ALGO');
204:             $criteria->addSelectColumn($alias . '.SALT');
205:             $criteria->addSelectColumn($alias . '.CREATED_AT');
206:             $criteria->addSelectColumn($alias . '.UPDATED_AT');
207:         }
208:     }
209: 
210:     /**
211:      * Returns the number of rows matching criteria.
212:      *
213:      * @param      Criteria $criteria
214:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
215:      * @param      PropelPDO $con
216:      * @return int Number of matching rows.
217:      */
218:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
219:     {
220:         // we may modify criteria, so copy it first
221:         $criteria = clone $criteria;
222: 
223:         // We need to set the primary table name, since in the case that there are no WHERE columns
224:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
225:         // tables go into the FROM clause.
226:         $criteria->setPrimaryTableName(AdminPeer::TABLE_NAME);
227: 
228:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
229:             $criteria->setDistinct();
230:         }
231: 
232:         if (!$criteria->hasSelectClause()) {
233:             AdminPeer::addSelectColumns($criteria);
234:         }
235: 
236:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
237:         $criteria->setDbName(AdminPeer::DATABASE_NAME); // Set the correct dbName
238: 
239:         if ($con === null) {
240:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
241:         }
242:         // BasePeer returns a PDOStatement
243:         $stmt = BasePeer::doCount($criteria, $con);
244: 
245:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
246:             $count = (int) $row[0];
247:         } else {
248:             $count = 0; // no rows returned; we infer that means 0 matches.
249:         }
250:         $stmt->closeCursor();
251: 
252:         return $count;
253:     }
254:     /**
255:      * Selects one object from the DB.
256:      *
257:      * @param      Criteria $criteria object used to create the SELECT statement.
258:      * @param      PropelPDO $con
259:      * @return                 Admin
260:      * @throws PropelException Any exceptions caught during processing will be
261:      *       rethrown wrapped into a PropelException.
262:      */
263:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
264:     {
265:         $critcopy = clone $criteria;
266:         $critcopy->setLimit(1);
267:         $objects = AdminPeer::doSelect($critcopy, $con);
268:         if ($objects) {
269:             return $objects[0];
270:         }
271: 
272:         return null;
273:     }
274:     /**
275:      * Selects several row from the DB.
276:      *
277:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
278:      * @param      PropelPDO $con
279:      * @return array           Array of selected Objects
280:      * @throws PropelException Any exceptions caught during processing will be
281:      *       rethrown wrapped into a PropelException.
282:      */
283:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
284:     {
285:         return AdminPeer::populateObjects(AdminPeer::doSelectStmt($criteria, $con));
286:     }
287:     /**
288:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
289:      *
290:      * Use this method directly if you want to work with an executed statement durirectly (for example
291:      * to perform your own object hydration).
292:      *
293:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
294:      * @param      PropelPDO $con The connection to use
295:      * @throws PropelException Any exceptions caught during processing will be
296:      *       rethrown wrapped into a PropelException.
297:      * @return PDOStatement The executed PDOStatement object.
298:      * @see        BasePeer::doSelect()
299:      */
300:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
301:     {
302:         if ($con === null) {
303:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
304:         }
305: 
306:         if (!$criteria->hasSelectClause()) {
307:             $criteria = clone $criteria;
308:             AdminPeer::addSelectColumns($criteria);
309:         }
310: 
311:         // Set the correct dbName
312:         $criteria->setDbName(AdminPeer::DATABASE_NAME);
313: 
314:         // BasePeer returns a PDOStatement
315:         return BasePeer::doSelect($criteria, $con);
316:     }
317:     /**
318:      * Adds an object to the instance pool.
319:      *
320:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
321:      * from the database.  In some cases -- especially when you override doSelect*()
322:      * methods in your stub classes -- you may need to explicitly add objects
323:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
324:      * and retrieveByPK*() calls.
325:      *
326:      * @param      Admin $obj A Admin object.
327:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
328:      */
329:     public static function addInstanceToPool($obj, $key = null)
330:     {
331:         if (Propel::isInstancePoolingEnabled()) {
332:             if ($key === null) {
333:                 $key = (string) $obj->getId();
334:             } // if key === null
335:             AdminPeer::$instances[$key] = $obj;
336:         }
337:     }
338: 
339:     /**
340:      * Removes an object from the instance pool.
341:      *
342:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
343:      * from the database.  In some cases -- especially when you override doDelete
344:      * methods in your stub classes -- you may need to explicitly remove objects
345:      * from the cache in order to prevent returning objects that no longer exist.
346:      *
347:      * @param      mixed $value A Admin object or a primary key value.
348:      *
349:      * @return void
350:      * @throws PropelException - if the value is invalid.
351:      */
352:     public static function removeInstanceFromPool($value)
353:     {
354:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
355:             if (is_object($value) && $value instanceof Admin) {
356:                 $key = (string) $value->getId();
357:             } elseif (is_scalar($value)) {
358:                 // assume we've been passed a primary key
359:                 $key = (string) $value;
360:             } else {
361:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Admin object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
362:                 throw $e;
363:             }
364: 
365:             unset(AdminPeer::$instances[$key]);
366:         }
367:     } // removeInstanceFromPool()
368: 
369:     /**
370:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
371:      *
372:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
373:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
374:      *
375:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
376:      * @return   Admin Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
377:      * @see        getPrimaryKeyHash()
378:      */
379:     public static function getInstanceFromPool($key)
380:     {
381:         if (Propel::isInstancePoolingEnabled()) {
382:             if (isset(AdminPeer::$instances[$key])) {
383:                 return AdminPeer::$instances[$key];
384:             }
385:         }
386: 
387:         return null; // just to be explicit
388:     }
389: 
390:     /**
391:      * Clear the instance pool.
392:      *
393:      * @return void
394:      */
395:     public static function clearInstancePool()
396:     {
397:         AdminPeer::$instances = array();
398:     }
399: 
400:     /**
401:      * Method to invalidate the instance pool of all tables related to admin
402:      * by a foreign key with ON DELETE CASCADE
403:      */
404:     public static function clearRelatedInstancePool()
405:     {
406:         // Invalidate objects in AdminGroupPeer instance pool,
407:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
408:         AdminGroupPeer::clearInstancePool();
409:     }
410: 
411:     /**
412:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
413:      *
414:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
415:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
416:      *
417:      * @param      array $row PropelPDO resultset row.
418:      * @param      int $startcol The 0-based offset for reading from the resultset row.
419:      * @return string A string version of PK or null if the components of primary key in result array are all null.
420:      */
421:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
422:     {
423:         // If the PK cannot be derived from the row, return null.
424:         if ($row[$startcol] === null) {
425:             return null;
426:         }
427: 
428:         return (string) $row[$startcol];
429:     }
430: 
431:     /**
432:      * Retrieves the primary key from the DB resultset row
433:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
434:      * a multi-column primary key, an array of the primary key columns will be returned.
435:      *
436:      * @param      array $row PropelPDO resultset row.
437:      * @param      int $startcol The 0-based offset for reading from the resultset row.
438:      * @return mixed The primary key of the row
439:      */
440:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
441:     {
442: 
443:         return (int) $row[$startcol];
444:     }
445: 
446:     /**
447:      * The returned array will contain objects of the default type or
448:      * objects that inherit from the default.
449:      *
450:      * @throws PropelException Any exceptions caught during processing will be
451:      *       rethrown wrapped into a PropelException.
452:      */
453:     public static function populateObjects(PDOStatement $stmt)
454:     {
455:         $results = array();
456: 
457:         // set the class once to avoid overhead in the loop
458:         $cls = AdminPeer::getOMClass();
459:         // populate the object(s)
460:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
461:             $key = AdminPeer::getPrimaryKeyHashFromRow($row, 0);
462:             if (null !== ($obj = AdminPeer::getInstanceFromPool($key))) {
463:                 // We no longer rehydrate the object, since this can cause data loss.
464:                 // See http://www.propelorm.org/ticket/509
465:                 // $obj->hydrate($row, 0, true); // rehydrate
466:                 $results[] = $obj;
467:             } else {
468:                 $obj = new $cls();
469:                 $obj->hydrate($row);
470:                 $results[] = $obj;
471:                 AdminPeer::addInstanceToPool($obj, $key);
472:             } // if key exists
473:         }
474:         $stmt->closeCursor();
475: 
476:         return $results;
477:     }
478:     /**
479:      * Populates an object of the default type or an object that inherit from the default.
480:      *
481:      * @param      array $row PropelPDO resultset row.
482:      * @param      int $startcol The 0-based offset for reading from the resultset row.
483:      * @throws PropelException Any exceptions caught during processing will be
484:      *       rethrown wrapped into a PropelException.
485:      * @return array (Admin object, last column rank)
486:      */
487:     public static function populateObject($row, $startcol = 0)
488:     {
489:         $key = AdminPeer::getPrimaryKeyHashFromRow($row, $startcol);
490:         if (null !== ($obj = AdminPeer::getInstanceFromPool($key))) {
491:             // We no longer rehydrate the object, since this can cause data loss.
492:             // See http://www.propelorm.org/ticket/509
493:             // $obj->hydrate($row, $startcol, true); // rehydrate
494:             $col = $startcol + AdminPeer::NUM_HYDRATE_COLUMNS;
495:         } else {
496:             $cls = AdminPeer::OM_CLASS;
497:             $obj = new $cls();
498:             $col = $obj->hydrate($row, $startcol);
499:             AdminPeer::addInstanceToPool($obj, $key);
500:         }
501: 
502:         return array($obj, $col);
503:     }
504: 
505:     /**
506:      * Returns the TableMap related to this peer.
507:      * This method is not needed for general use but a specific application could have a need.
508:      * @return TableMap
509:      * @throws PropelException Any exceptions caught during processing will be
510:      *       rethrown wrapped into a PropelException.
511:      */
512:     public static function getTableMap()
513:     {
514:         return Propel::getDatabaseMap(AdminPeer::DATABASE_NAME)->getTable(AdminPeer::TABLE_NAME);
515:     }
516: 
517:     /**
518:      * Add a TableMap instance to the database for this peer class.
519:      */
520:     public static function buildTableMap()
521:     {
522:       $dbMap = Propel::getDatabaseMap(BaseAdminPeer::DATABASE_NAME);
523:       if (!$dbMap->hasTable(BaseAdminPeer::TABLE_NAME)) {
524:         $dbMap->addTableObject(new AdminTableMap());
525:       }
526:     }
527: 
528:     /**
529:      * The class that the Peer will make instances of.
530:      *
531:      *
532:      * @return string ClassName
533:      */
534:     public static function getOMClass()
535:     {
536:         return AdminPeer::OM_CLASS;
537:     }
538: 
539:     /**
540:      * Performs an INSERT on the database, given a Admin or Criteria object.
541:      *
542:      * @param      mixed $values Criteria or Admin object containing data that is used to create the INSERT statement.
543:      * @param      PropelPDO $con the PropelPDO connection to use
544:      * @return mixed           The new primary key.
545:      * @throws PropelException Any exceptions caught during processing will be
546:      *       rethrown wrapped into a PropelException.
547:      */
548:     public static function doInsert($values, PropelPDO $con = null)
549:     {
550:         if ($con === null) {
551:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
552:         }
553: 
554:         if ($values instanceof Criteria) {
555:             $criteria = clone $values; // rename for clarity
556:         } else {
557:             $criteria = $values->buildCriteria(); // build Criteria from Admin object
558:         }
559: 
560:         if ($criteria->containsKey(AdminPeer::ID) && $criteria->keyContainsValue(AdminPeer::ID) ) {
561:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.AdminPeer::ID.')');
562:         }
563: 
564: 
565:         // Set the correct dbName
566:         $criteria->setDbName(AdminPeer::DATABASE_NAME);
567: 
568:         try {
569:             // use transaction because $criteria could contain info
570:             // for more than one table (I guess, conceivably)
571:             $con->beginTransaction();
572:             $pk = BasePeer::doInsert($criteria, $con);
573:             $con->commit();
574:         } catch (PropelException $e) {
575:             $con->rollBack();
576:             throw $e;
577:         }
578: 
579:         return $pk;
580:     }
581: 
582:     /**
583:      * Performs an UPDATE on the database, given a Admin or Criteria object.
584:      *
585:      * @param      mixed $values Criteria or Admin object containing data that is used to create the UPDATE statement.
586:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
587:      * @return int             The number of affected rows (if supported by underlying database driver).
588:      * @throws PropelException Any exceptions caught during processing will be
589:      *       rethrown wrapped into a PropelException.
590:      */
591:     public static function doUpdate($values, PropelPDO $con = null)
592:     {
593:         if ($con === null) {
594:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
595:         }
596: 
597:         $selectCriteria = new Criteria(AdminPeer::DATABASE_NAME);
598: 
599:         if ($values instanceof Criteria) {
600:             $criteria = clone $values; // rename for clarity
601: 
602:             $comparison = $criteria->getComparison(AdminPeer::ID);
603:             $value = $criteria->remove(AdminPeer::ID);
604:             if ($value) {
605:                 $selectCriteria->add(AdminPeer::ID, $value, $comparison);
606:             } else {
607:                 $selectCriteria->setPrimaryTableName(AdminPeer::TABLE_NAME);
608:             }
609: 
610:         } else { // $values is Admin object
611:             $criteria = $values->buildCriteria(); // gets full criteria
612:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
613:         }
614: 
615:         // set the correct dbName
616:         $criteria->setDbName(AdminPeer::DATABASE_NAME);
617: 
618:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
619:     }
620: 
621:     /**
622:      * Deletes all rows from the admin table.
623:      *
624:      * @param      PropelPDO $con the connection to use
625:      * @return int             The number of affected rows (if supported by underlying database driver).
626:      * @throws PropelException
627:      */
628:     public static function doDeleteAll(PropelPDO $con = null)
629:     {
630:         if ($con === null) {
631:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
632:         }
633:         $affectedRows = 0; // initialize var to track total num of affected rows
634:         try {
635:             // use transaction because $criteria could contain info
636:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
637:             $con->beginTransaction();
638:             $affectedRows += BasePeer::doDeleteAll(AdminPeer::TABLE_NAME, $con, AdminPeer::DATABASE_NAME);
639:             // Because this db requires some delete cascade/set null emulation, we have to
640:             // clear the cached instance *after* the emulation has happened (since
641:             // instances get re-added by the select statement contained therein).
642:             AdminPeer::clearInstancePool();
643:             AdminPeer::clearRelatedInstancePool();
644:             $con->commit();
645: 
646:             return $affectedRows;
647:         } catch (PropelException $e) {
648:             $con->rollBack();
649:             throw $e;
650:         }
651:     }
652: 
653:     /**
654:      * Performs a DELETE on the database, given a Admin or Criteria object OR a primary key value.
655:      *
656:      * @param      mixed $values Criteria or Admin object or primary key or array of primary keys
657:      *              which is used to create the DELETE statement
658:      * @param      PropelPDO $con the connection to use
659:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
660:      *              if supported by native driver or if emulated using Propel.
661:      * @throws PropelException Any exceptions caught during processing will be
662:      *       rethrown wrapped into a PropelException.
663:      */
664:      public static function doDelete($values, PropelPDO $con = null)
665:      {
666:         if ($con === null) {
667:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
668:         }
669: 
670:         if ($values instanceof Criteria) {
671:             // invalidate the cache for all objects of this type, since we have no
672:             // way of knowing (without running a query) what objects should be invalidated
673:             // from the cache based on this Criteria.
674:             AdminPeer::clearInstancePool();
675:             // rename for clarity
676:             $criteria = clone $values;
677:         } elseif ($values instanceof Admin) { // it's a model object
678:             // invalidate the cache for this single object
679:             AdminPeer::removeInstanceFromPool($values);
680:             // create criteria based on pk values
681:             $criteria = $values->buildPkeyCriteria();
682:         } else { // it's a primary key, or an array of pks
683:             $criteria = new Criteria(AdminPeer::DATABASE_NAME);
684:             $criteria->add(AdminPeer::ID, (array) $values, Criteria::IN);
685:             // invalidate the cache for this object(s)
686:             foreach ((array) $values as $singleval) {
687:                 AdminPeer::removeInstanceFromPool($singleval);
688:             }
689:         }
690: 
691:         // Set the correct dbName
692:         $criteria->setDbName(AdminPeer::DATABASE_NAME);
693: 
694:         $affectedRows = 0; // initialize var to track total num of affected rows
695: 
696:         try {
697:             // use transaction because $criteria could contain info
698:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
699:             $con->beginTransaction();
700: 
701:             $affectedRows += BasePeer::doDelete($criteria, $con);
702:             AdminPeer::clearRelatedInstancePool();
703:             $con->commit();
704: 
705:             return $affectedRows;
706:         } catch (PropelException $e) {
707:             $con->rollBack();
708:             throw $e;
709:         }
710:     }
711: 
712:     /**
713:      * Validates all modified columns of given Admin object.
714:      * If parameter $columns is either a single column name or an array of column names
715:      * than only those columns are validated.
716:      *
717:      * NOTICE: This does not apply to primary or foreign keys for now.
718:      *
719:      * @param      Admin $obj The object to validate.
720:      * @param      mixed $cols Column name or array of column names.
721:      *
722:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
723:      */
724:     public static function doValidate($obj, $cols = null)
725:     {
726:         $columns = array();
727: 
728:         if ($cols) {
729:             $dbMap = Propel::getDatabaseMap(AdminPeer::DATABASE_NAME);
730:             $tableMap = $dbMap->getTable(AdminPeer::TABLE_NAME);
731: 
732:             if (! is_array($cols)) {
733:                 $cols = array($cols);
734:             }
735: 
736:             foreach ($cols as $colName) {
737:                 if ($tableMap->hasColumn($colName)) {
738:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
739:                     $columns[$colName] = $obj->$get();
740:                 }
741:             }
742:         } else {
743: 
744:         }
745: 
746:         return BasePeer::doValidate(AdminPeer::DATABASE_NAME, AdminPeer::TABLE_NAME, $columns);
747:     }
748: 
749:     /**
750:      * Retrieve a single object by pkey.
751:      *
752:      * @param      int $pk the primary key.
753:      * @param      PropelPDO $con the connection to use
754:      * @return Admin
755:      */
756:     public static function retrieveByPK($pk, PropelPDO $con = null)
757:     {
758: 
759:         if (null !== ($obj = AdminPeer::getInstanceFromPool((string) $pk))) {
760:             return $obj;
761:         }
762: 
763:         if ($con === null) {
764:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
765:         }
766: 
767:         $criteria = new Criteria(AdminPeer::DATABASE_NAME);
768:         $criteria->add(AdminPeer::ID, $pk);
769: 
770:         $v = AdminPeer::doSelect($criteria, $con);
771: 
772:         return !empty($v) > 0 ? $v[0] : null;
773:     }
774: 
775:     /**
776:      * Retrieve multiple objects by pkey.
777:      *
778:      * @param      array $pks List of primary keys
779:      * @param      PropelPDO $con the connection to use
780:      * @return Admin[]
781:      * @throws PropelException Any exceptions caught during processing will be
782:      *       rethrown wrapped into a PropelException.
783:      */
784:     public static function retrieveByPKs($pks, PropelPDO $con = null)
785:     {
786:         if ($con === null) {
787:             $con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
788:         }
789: 
790:         $objs = null;
791:         if (empty($pks)) {
792:             $objs = array();
793:         } else {
794:             $criteria = new Criteria(AdminPeer::DATABASE_NAME);
795:             $criteria->add(AdminPeer::ID, $pks, Criteria::IN);
796:             $objs = AdminPeer::doSelect($criteria, $con);
797:         }
798: 
799:         return $objs;
800:     }
801: 
802: } // BaseAdminPeer
803: 
804: // This is the static code needed to register the TableMap for this table with the main Propel class.
805: //
806: BaseAdminPeer::buildTableMap();
807: 
808: 
thelia API documentation generated by ApiGen 2.8.0