/**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @return CustomListElement[]
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(CustomListElementPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(CustomListElementPeer::DATABASE_NAME);
         $criteria->add(CustomListElementPeer::ID_ELEMENT, $pks, Criteria::IN);
         $objs = CustomListElementPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = CustomListsPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related CustomListElement objects
         $criteria = new Criteria(CustomListElementPeer::DATABASE_NAME);
         $criteria->add(CustomListElementPeer::CUSTOM_LIST, $obj->getIdCustomList());
         $affectedRows += CustomListElementPeer::doDelete($criteria, $con);
         // delete related CyclicalEventHasList objects
         $criteria = new Criteria(CyclicalEventHasListPeer::DATABASE_NAME);
         $criteria->add(CyclicalEventHasListPeer::ID_LIST, $obj->getIdCustomList());
         $affectedRows += CyclicalEventHasListPeer::doDelete($criteria, $con);
         // delete related EventHasList objects
         $criteria = new Criteria(EventHasListPeer::DATABASE_NAME);
         $criteria->add(EventHasListPeer::ID_LIST, $obj->getIdCustomList());
         $affectedRows += EventHasListPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggregated array of ValidationFailed objects will be returned.
  *
  * @param array $columns Array of column names to validate.
  * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aCustomLists !== null) {
             if (!$this->aCustomLists->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aCustomLists->getValidationFailures());
             }
         }
         if (($retval = CustomListElementPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return                 CustomListElement A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `id_element`, `custom_list`, `element_name`, `element_description`, `element_order`, `created_at`, `updated_at` FROM `custom_list_element` WHERE `id_element` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new CustomListElement();
         $obj->hydrate($row);
         CustomListElementPeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }