start to create config process for Thelia

This commit is contained in:
Manuel Raynaud
2013-03-28 16:43:01 +01:00
parent 2154bbc1ed
commit 879a2e09a8
8 changed files with 133 additions and 45 deletions

View File

@@ -18,10 +18,14 @@ use Thelia\Model\om\BaseModuleQuery;
*/
class ModuleQuery extends BaseModuleQuery
{
/**
* @return array|mixed|\PropelObjectCollection
*/
public static function getActivated()
{
return self::create()
->findByActivate(1)
->find();
->filterByActivate(1)
->find()
;
}
}

View File

@@ -40,7 +40,7 @@ class ModuleTableMap extends TableMap
$this->setPhpName('Module');
$this->setClassname('Thelia\\Model\\Module');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('code', 'Code', 'VARCHAR', true, 55, null);

View File

@@ -735,6 +735,10 @@ abstract class BaseModule extends BaseObject implements Persistent
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = ModulePeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModulePeer::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(ModulePeer::ID)) {
@@ -798,6 +802,13 @@ abstract class BaseModule extends BaseObject implements Persistent
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', $e);
}
$this->setId($pk);
$this->setNew(false);
}

View File

@@ -565,6 +565,10 @@ abstract class BaseModulePeer
$criteria = $values->buildCriteria(); // build Criteria from Module object
}
if ($criteria->containsKey(ModulePeer::ID) && $criteria->keyContainsValue(ModulePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ModulePeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(ModulePeer::DATABASE_NAME);