/** * Helper method which returns the primary key contained * in the given Criteria object. * * @param Criteria $criteria A Criteria. * @return ColumnMap If the Criteria object contains a primary * key, or null if it doesn't. * @throws \Propel\Runtime\Exception\RuntimeException */ private static function getPrimaryKey(Criteria $criteria) { // Assume all the keys are for the same table. $keys = $criteria->keys(); $key = $keys[0]; $table = $criteria->getTableName($key); $pk = null; if (!empty($table)) { $dbMap = Propel::getServiceContainer()->getDatabaseMap($criteria->getDbName()); $pks = $dbMap->getTable($table)->getPrimaryKeys(); if (!empty($pks)) { $pk = array_shift($pks); } } return $pk; }