first commit
This commit is contained in:
@@ -0,0 +1,995 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'st_admin_generator_filter' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stAdminGeneratorPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseAdminGeneratorFilter extends BaseObject implements Persistent {
|
||||
|
||||
|
||||
protected static $dispatcher = null;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the guard_user_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $guard_user_id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the data_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $data_id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the name field.
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the module_namespace field.
|
||||
* @var string
|
||||
*/
|
||||
protected $module_namespace;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the is_global field.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $is_global = false;
|
||||
|
||||
/**
|
||||
* @var sfGuardUser
|
||||
*/
|
||||
protected $asfGuardUser;
|
||||
|
||||
/**
|
||||
* @var AdminGeneratorFilterData
|
||||
*/
|
||||
protected $aAdminGeneratorFilterData;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless validation loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [guard_user_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getGuardUserId()
|
||||
{
|
||||
|
||||
return $this->guard_user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [data_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDataId()
|
||||
{
|
||||
|
||||
return $this->data_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [name] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [module_namespace] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleNamespace()
|
||||
{
|
||||
|
||||
return $this->module_namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [is_global] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsGlobal()
|
||||
{
|
||||
|
||||
return $this->is_global;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->id !== $v) {
|
||||
$this->id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::ID;
|
||||
}
|
||||
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [guard_user_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setGuardUserId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->guard_user_id !== $v) {
|
||||
$this->guard_user_id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::GUARD_USER_ID;
|
||||
}
|
||||
|
||||
if ($this->asfGuardUser !== null && $this->asfGuardUser->getId() !== $v) {
|
||||
$this->asfGuardUser = null;
|
||||
}
|
||||
|
||||
} // setGuardUserId()
|
||||
|
||||
/**
|
||||
* Set the value of [data_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setDataId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->data_id !== $v) {
|
||||
$this->data_id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::DATA_ID;
|
||||
}
|
||||
|
||||
if ($this->aAdminGeneratorFilterData !== null && $this->aAdminGeneratorFilterData->getId() !== $v) {
|
||||
$this->aAdminGeneratorFilterData = null;
|
||||
}
|
||||
|
||||
} // setDataId()
|
||||
|
||||
/**
|
||||
* Set the value of [name] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setName($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->name !== $v) {
|
||||
$this->name = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::NAME;
|
||||
}
|
||||
|
||||
} // setName()
|
||||
|
||||
/**
|
||||
* Set the value of [module_namespace] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setModuleNamespace($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->module_namespace !== $v) {
|
||||
$this->module_namespace = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::MODULE_NAMESPACE;
|
||||
}
|
||||
|
||||
} // setModuleNamespace()
|
||||
|
||||
/**
|
||||
* Set the value of [is_global] column.
|
||||
*
|
||||
* @param boolean $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setIsGlobal($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_bool($v)) {
|
||||
$v = (bool) $v;
|
||||
}
|
||||
|
||||
if ($this->is_global !== $v || $v === false) {
|
||||
$this->is_global = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterPeer::IS_GLOBAL;
|
||||
}
|
||||
|
||||
} // setIsGlobal()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
* An offset (1-based "start column") is specified so that objects can be hydrated
|
||||
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||
* for results of JOIN queries where the resultset row includes columns from two or
|
||||
* more tables.
|
||||
*
|
||||
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
|
||||
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
|
||||
* @return int next starting column
|
||||
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||
*/
|
||||
public function hydrate(ResultSet $rs, $startcol = 1)
|
||||
{
|
||||
try {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.preHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.preHydrate', array('resultset' => $rs, 'startcol' => $startcol)));
|
||||
$startcol = $event['startcol'];
|
||||
}
|
||||
|
||||
$this->id = $rs->getInt($startcol + 0);
|
||||
|
||||
$this->guard_user_id = $rs->getInt($startcol + 1);
|
||||
|
||||
$this->data_id = $rs->getInt($startcol + 2);
|
||||
|
||||
$this->name = $rs->getString($startcol + 3);
|
||||
|
||||
$this->module_namespace = $rs->getString($startcol + 4);
|
||||
|
||||
$this->is_global = $rs->getBoolean($startcol + 5);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.postHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 6)));
|
||||
return $event['startcol'];
|
||||
}
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 6; // 6 = AdminGeneratorFilterPeer::NUM_COLUMNS - AdminGeneratorFilterPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating AdminGeneratorFilter object", $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this object from datastore and sets delete attribute.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
* @see BaseObject::setDeleted()
|
||||
* @see BaseObject::isDeleted()
|
||||
*/
|
||||
public function delete($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("This object has already been deleted.");
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.preDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.preDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorFilter:delete:pre'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilter:delete:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, $this, $con);
|
||||
if ($ret)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorFilterPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
AdminGeneratorFilterPeer::doDelete($this, $con);
|
||||
$this->setDeleted(true);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.postDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.postDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorFilter:delete:post'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilter:delete:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database. If the object is new,
|
||||
* it inserts it; otherwise an update is performed. This method
|
||||
* wraps the doSave() worker method in a transaction.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see doSave()
|
||||
*/
|
||||
public function save($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("You cannot save an object that has been deleted.");
|
||||
}
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.preSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.preSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilter:save:pre') as $callable)
|
||||
{
|
||||
$affectedRows = call_user_func($callable, $this, $con);
|
||||
if (is_int($affectedRows))
|
||||
{
|
||||
return $affectedRows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorFilterPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
$affectedRows = $this->doSave($con);
|
||||
$con->commit();
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilter.postSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilter.postSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilter:save:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con, $affectedRows);
|
||||
}
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database.
|
||||
*
|
||||
* If the object is new, it inserts it; otherwise an update is performed.
|
||||
* All related objects are also updated in this method.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see save()
|
||||
*/
|
||||
protected function doSave($con)
|
||||
{
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
|
||||
// We call the save method on the following object(s) if they
|
||||
// were passed to this object by their coresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->asfGuardUser !== null) {
|
||||
if ($this->asfGuardUser->isModified()) {
|
||||
$affectedRows += $this->asfGuardUser->save($con);
|
||||
}
|
||||
$this->setsfGuardUser($this->asfGuardUser);
|
||||
}
|
||||
|
||||
if ($this->aAdminGeneratorFilterData !== null) {
|
||||
if ($this->aAdminGeneratorFilterData->isModified()) {
|
||||
$affectedRows += $this->aAdminGeneratorFilterData->save($con);
|
||||
}
|
||||
$this->setAdminGeneratorFilterData($this->aAdminGeneratorFilterData);
|
||||
}
|
||||
|
||||
|
||||
// If this object has been modified, then save it to the database.
|
||||
if ($this->isModified()) {
|
||||
if ($this->isNew()) {
|
||||
$pk = AdminGeneratorFilterPeer::doInsert($this, $con);
|
||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||
// should always be true here (even though technically
|
||||
// BasePeer::doInsert() can insert multiple rows).
|
||||
|
||||
$this->setId($pk); //[IMV] update autoincrement primary key
|
||||
|
||||
$this->setNew(false);
|
||||
} else {
|
||||
$affectedRows += AdminGeneratorFilterPeer::doUpdate($this, $con);
|
||||
}
|
||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
}
|
||||
return $affectedRows;
|
||||
} // doSave()
|
||||
|
||||
/**
|
||||
* Array of ValidationFailed objects.
|
||||
* @var array ValidationFailed[]
|
||||
*/
|
||||
protected $validationFailures = array();
|
||||
|
||||
/**
|
||||
* Gets any ValidationFailed objects that resulted from last call to validate().
|
||||
*
|
||||
*
|
||||
* @return array ValidationFailed[]
|
||||
* @see validate()
|
||||
*/
|
||||
public function getValidationFailures()
|
||||
{
|
||||
return $this->validationFailures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the objects modified field values and all objects related to this table.
|
||||
*
|
||||
* If $columns is either a column name or an array of column names
|
||||
* only those columns are validated.
|
||||
*
|
||||
* @param mixed $columns Column name or an array of column names.
|
||||
* @return boolean Whether all columns pass validation.
|
||||
* @see doValidate()
|
||||
* @see getValidationFailures()
|
||||
*/
|
||||
public function validate($columns = null)
|
||||
{
|
||||
$res = $this->doValidate($columns);
|
||||
if ($res === true) {
|
||||
$this->validationFailures = array();
|
||||
return true;
|
||||
} else {
|
||||
$this->validationFailures = $res;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 aggreagated 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> objets 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 coresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->asfGuardUser !== null) {
|
||||
if (!$this->asfGuardUser->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->asfGuardUser->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aAdminGeneratorFilterData !== null) {
|
||||
if (!$this->aAdminGeneratorFilterData->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAdminGeneratorFilterData->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AdminGeneratorFilterPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
||||
return (!empty($failureMap) ? $failureMap : true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name name
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return mixed Value of field.
|
||||
*/
|
||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorFilterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->getByPosition($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @return mixed Value of field at $pos
|
||||
*/
|
||||
public function getByPosition($pos)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getGuardUserId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getDataId();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getName();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getModuleNamespace();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getIsGlobal();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the object as an array.
|
||||
*
|
||||
* You can specify the key type of the array by passing one of the class
|
||||
* type constants.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorFilterPeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getGuardUserId(),
|
||||
$keys[2] => $this->getDataId(),
|
||||
$keys[3] => $this->getName(),
|
||||
$keys[4] => $this->getModuleNamespace(),
|
||||
$keys[5] => $this->getIsGlobal(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name peer name
|
||||
* @param mixed $value field value
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return void
|
||||
*/
|
||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorFilterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->setByPosition($pos, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @param mixed $value field value
|
||||
* @return void
|
||||
*/
|
||||
public function setByPosition($pos, $value)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setGuardUserId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setDataId($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setName($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setModuleNamespace($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setIsGlobal($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the object using an array.
|
||||
*
|
||||
* This is particularly useful when populating an object from one of the
|
||||
* request arrays (e.g. $_POST). This method goes through the column
|
||||
* names, checking to see whether a matching key exists in populated
|
||||
* array. If so the setByName() method is called for that column.
|
||||
*
|
||||
* You can specify the key type of the array by additionally passing one
|
||||
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
|
||||
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
|
||||
*
|
||||
* @param array $arr An array to populate the object from.
|
||||
* @param string $keyType The type of keys the array uses.
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorFilterPeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setGuardUserId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDataId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setModuleNamespace($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setIsGlobal($arr[$keys[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Criteria object containing the values of all modified columns in this object.
|
||||
*
|
||||
* @return Criteria The Criteria object containing all modified values.
|
||||
*/
|
||||
public function buildCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorFilterPeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::ID)) $criteria->add(AdminGeneratorFilterPeer::ID, $this->id);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::GUARD_USER_ID)) $criteria->add(AdminGeneratorFilterPeer::GUARD_USER_ID, $this->guard_user_id);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::DATA_ID)) $criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->data_id);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::NAME)) $criteria->add(AdminGeneratorFilterPeer::NAME, $this->name);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::MODULE_NAMESPACE)) $criteria->add(AdminGeneratorFilterPeer::MODULE_NAMESPACE, $this->module_namespace);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterPeer::IS_GLOBAL)) $criteria->add(AdminGeneratorFilterPeer::IS_GLOBAL, $this->is_global);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a Criteria object containing the primary key for this object.
|
||||
*
|
||||
* Unlike buildCriteria() this method includes the primary key values regardless
|
||||
* of whether or not they have been modified.
|
||||
*
|
||||
* @return Criteria The Criteria object containing value(s) for primary key(s).
|
||||
*/
|
||||
public function buildPkeyCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorFilterPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::ID, $this->id);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return int
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns [composite] primary key fields
|
||||
*
|
||||
* @param string $keyType
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
return array(AdminGeneratorFilterPeer::translateFieldName('id', BasePeer::TYPE_FIELDNAME, $keyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (id column).
|
||||
*
|
||||
* @param int $key Primary key.
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
{
|
||||
$this->setId($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contents of passed object to values from current object.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param object $copyObj An object of AdminGeneratorFilter (or compatible) type.
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setGuardUserId($this->guard_user_id);
|
||||
|
||||
$copyObj->setDataId($this->data_id);
|
||||
|
||||
$copyObj->setName($this->name);
|
||||
|
||||
$copyObj->setModuleNamespace($this->module_namespace);
|
||||
|
||||
$copyObj->setIsGlobal($this->is_global);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
$copyObj->setId(NULL); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a copy of this object that will be inserted as a new row in table when saved.
|
||||
* It creates a new object filling in the simple attributes, but skipping any primary
|
||||
* keys that are defined for the table.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @return AdminGeneratorFilter Clone of current object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copy($deepCopy = false)
|
||||
{
|
||||
// we use get_class(), because this might be a subclass
|
||||
$clazz = get_class($this);
|
||||
$copyObj = new $clazz();
|
||||
$this->copyInto($copyObj, $deepCopy);
|
||||
return $copyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a peer instance associated with this om.
|
||||
*
|
||||
* @return string Peer class name
|
||||
*/
|
||||
public function getPeer()
|
||||
{
|
||||
return 'AdminGeneratorFilterPeer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a sfGuardUser object.
|
||||
*
|
||||
* @param sfGuardUser $v
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setsfGuardUser($v)
|
||||
{
|
||||
|
||||
|
||||
if ($v === null) {
|
||||
$this->setGuardUserId(NULL);
|
||||
} else {
|
||||
$this->setGuardUserId($v->getId());
|
||||
}
|
||||
|
||||
|
||||
$this->asfGuardUser = $v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated sfGuardUser object
|
||||
*
|
||||
* @param Connection Optional Connection object.
|
||||
* @return sfGuardUser The associated sfGuardUser object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getsfGuardUser($con = null)
|
||||
{
|
||||
if ($this->asfGuardUser === null && ($this->guard_user_id !== null)) {
|
||||
// include the related Peer class
|
||||
$this->asfGuardUser = sfGuardUserPeer::retrieveByPK($this->guard_user_id, $con);
|
||||
|
||||
/* The following can be used instead of the line above to
|
||||
guarantee the related object contains a reference
|
||||
to this object, but this level of coupling
|
||||
may be undesirable in many circumstances.
|
||||
As it can lead to a db query with many results that may
|
||||
never be used.
|
||||
$obj = sfGuardUserPeer::retrieveByPK($this->guard_user_id, $con);
|
||||
$obj->addsfGuardUsers($this);
|
||||
*/
|
||||
}
|
||||
return $this->asfGuardUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a AdminGeneratorFilterData object.
|
||||
*
|
||||
* @param AdminGeneratorFilterData $v
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAdminGeneratorFilterData($v)
|
||||
{
|
||||
|
||||
|
||||
if ($v === null) {
|
||||
$this->setDataId(NULL);
|
||||
} else {
|
||||
$this->setDataId($v->getId());
|
||||
}
|
||||
|
||||
|
||||
$this->aAdminGeneratorFilterData = $v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated AdminGeneratorFilterData object
|
||||
*
|
||||
* @param Connection Optional Connection object.
|
||||
* @return AdminGeneratorFilterData The associated AdminGeneratorFilterData object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdminGeneratorFilterData($con = null)
|
||||
{
|
||||
if ($this->aAdminGeneratorFilterData === null && ($this->data_id !== null)) {
|
||||
// include the related Peer class
|
||||
$this->aAdminGeneratorFilterData = AdminGeneratorFilterDataPeer::retrieveByPK($this->data_id, $con);
|
||||
|
||||
/* The following can be used instead of the line above to
|
||||
guarantee the related object contains a reference
|
||||
to this object, but this level of coupling
|
||||
may be undesirable in many circumstances.
|
||||
As it can lead to a db query with many results that may
|
||||
never be used.
|
||||
$obj = AdminGeneratorFilterDataPeer::retrieveByPK($this->data_id, $con);
|
||||
$obj->addAdminGeneratorFilterDatas($this);
|
||||
*/
|
||||
}
|
||||
return $this->aAdminGeneratorFilterData;
|
||||
}
|
||||
|
||||
|
||||
public function getDispatcher()
|
||||
{
|
||||
if (null === self::$dispatcher)
|
||||
{
|
||||
self::$dispatcher = stEventDispatcher::getInstance();
|
||||
}
|
||||
|
||||
return self::$dispatcher;
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
$event = $this->getDispatcher()->notifyUntil(new sfEvent($this, 'AdminGeneratorFilter.' . $method, array('arguments' => $arguments, 'method' => $method)));
|
||||
|
||||
if ($event->isProcessed())
|
||||
{
|
||||
return $event->getReturnValue();
|
||||
}
|
||||
|
||||
if (!$callable = sfMixer::getCallable('BaseAdminGeneratorFilter:'.$method))
|
||||
{
|
||||
throw new sfException(sprintf('Call to undefined method BaseAdminGeneratorFilter::%s', $method));
|
||||
}
|
||||
|
||||
array_unshift($arguments, $this);
|
||||
|
||||
return call_user_func_array($callable, $arguments);
|
||||
}
|
||||
|
||||
} // BaseAdminGeneratorFilter
|
||||
@@ -0,0 +1,831 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'st_admin_generator_filter_data' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stAdminGeneratorPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseAdminGeneratorFilterData extends BaseObject implements Persistent {
|
||||
|
||||
|
||||
protected static $dispatcher = null;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the data field.
|
||||
* @var array
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* Collection to store aggregation of collAdminGeneratorFilters.
|
||||
* @var array
|
||||
*/
|
||||
protected $collAdminGeneratorFilters;
|
||||
|
||||
/**
|
||||
* The criteria used to select the current contents of collAdminGeneratorFilters.
|
||||
* @var Criteria
|
||||
*/
|
||||
protected $lastAdminGeneratorFilterCriteria = null;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless validation loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [data] column value.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->id !== $v) {
|
||||
$this->id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterDataPeer::ID;
|
||||
}
|
||||
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [data] column.
|
||||
*
|
||||
* @param array $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setData($v)
|
||||
{
|
||||
|
||||
if ($this->data !== $v) {
|
||||
$this->data = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorFilterDataPeer::DATA;
|
||||
}
|
||||
|
||||
} // setData()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
* An offset (1-based "start column") is specified so that objects can be hydrated
|
||||
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||
* for results of JOIN queries where the resultset row includes columns from two or
|
||||
* more tables.
|
||||
*
|
||||
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
|
||||
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
|
||||
* @return int next starting column
|
||||
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||
*/
|
||||
public function hydrate(ResultSet $rs, $startcol = 1)
|
||||
{
|
||||
try {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.preHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.preHydrate', array('resultset' => $rs, 'startcol' => $startcol)));
|
||||
$startcol = $event['startcol'];
|
||||
}
|
||||
|
||||
$this->id = $rs->getInt($startcol + 0);
|
||||
|
||||
$this->data = $rs->getString($startcol + 1) ? unserialize($rs->getString($startcol + 1)) : null;
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.postHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 2)));
|
||||
return $event['startcol'];
|
||||
}
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 2; // 2 = AdminGeneratorFilterDataPeer::NUM_COLUMNS - AdminGeneratorFilterDataPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating AdminGeneratorFilterData object", $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this object from datastore and sets delete attribute.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
* @see BaseObject::setDeleted()
|
||||
* @see BaseObject::isDeleted()
|
||||
*/
|
||||
public function delete($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("This object has already been deleted.");
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.preDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.preDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorFilterData:delete:pre'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilterData:delete:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, $this, $con);
|
||||
if ($ret)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
AdminGeneratorFilterDataPeer::doDelete($this, $con);
|
||||
$this->setDeleted(true);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.postDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.postDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorFilterData:delete:post'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilterData:delete:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database. If the object is new,
|
||||
* it inserts it; otherwise an update is performed. This method
|
||||
* wraps the doSave() worker method in a transaction.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see doSave()
|
||||
*/
|
||||
public function save($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("You cannot save an object that has been deleted.");
|
||||
}
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.preSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.preSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilterData:save:pre') as $callable)
|
||||
{
|
||||
$affectedRows = call_user_func($callable, $this, $con);
|
||||
if (is_int($affectedRows))
|
||||
{
|
||||
return $affectedRows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
$affectedRows = $this->doSave($con);
|
||||
$con->commit();
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorFilterData.postSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorFilterData.postSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorFilterData:save:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con, $affectedRows);
|
||||
}
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database.
|
||||
*
|
||||
* If the object is new, it inserts it; otherwise an update is performed.
|
||||
* All related objects are also updated in this method.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see save()
|
||||
*/
|
||||
protected function doSave($con)
|
||||
{
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
|
||||
// If this object has been modified, then save it to the database.
|
||||
if ($this->isModified()) {
|
||||
if ($this->isNew()) {
|
||||
$pk = AdminGeneratorFilterDataPeer::doInsert($this, $con);
|
||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||
// should always be true here (even though technically
|
||||
// BasePeer::doInsert() can insert multiple rows).
|
||||
|
||||
$this->setId($pk); //[IMV] update autoincrement primary key
|
||||
|
||||
$this->setNew(false);
|
||||
} else {
|
||||
$affectedRows += AdminGeneratorFilterDataPeer::doUpdate($this, $con);
|
||||
}
|
||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
if ($this->collAdminGeneratorFilters !== null) {
|
||||
foreach($this->collAdminGeneratorFilters as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
}
|
||||
return $affectedRows;
|
||||
} // doSave()
|
||||
|
||||
/**
|
||||
* Array of ValidationFailed objects.
|
||||
* @var array ValidationFailed[]
|
||||
*/
|
||||
protected $validationFailures = array();
|
||||
|
||||
/**
|
||||
* Gets any ValidationFailed objects that resulted from last call to validate().
|
||||
*
|
||||
*
|
||||
* @return array ValidationFailed[]
|
||||
* @see validate()
|
||||
*/
|
||||
public function getValidationFailures()
|
||||
{
|
||||
return $this->validationFailures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the objects modified field values and all objects related to this table.
|
||||
*
|
||||
* If $columns is either a column name or an array of column names
|
||||
* only those columns are validated.
|
||||
*
|
||||
* @param mixed $columns Column name or an array of column names.
|
||||
* @return boolean Whether all columns pass validation.
|
||||
* @see doValidate()
|
||||
* @see getValidationFailures()
|
||||
*/
|
||||
public function validate($columns = null)
|
||||
{
|
||||
$res = $this->doValidate($columns);
|
||||
if ($res === true) {
|
||||
$this->validationFailures = array();
|
||||
return true;
|
||||
} else {
|
||||
$this->validationFailures = $res;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 aggreagated 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> objets otherwise.
|
||||
*/
|
||||
protected function doValidate($columns = null)
|
||||
{
|
||||
if (!$this->alreadyInValidation) {
|
||||
$this->alreadyInValidation = true;
|
||||
$retval = null;
|
||||
|
||||
$failureMap = array();
|
||||
|
||||
|
||||
if (($retval = AdminGeneratorFilterDataPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->collAdminGeneratorFilters !== null) {
|
||||
foreach($this->collAdminGeneratorFilters as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
||||
return (!empty($failureMap) ? $failureMap : true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name name
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return mixed Value of field.
|
||||
*/
|
||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorFilterDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->getByPosition($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @return mixed Value of field at $pos
|
||||
*/
|
||||
public function getByPosition($pos)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getData();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the object as an array.
|
||||
*
|
||||
* You can specify the key type of the array by passing one of the class
|
||||
* type constants.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorFilterDataPeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getData(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name peer name
|
||||
* @param mixed $value field value
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return void
|
||||
*/
|
||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorFilterDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->setByPosition($pos, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @param mixed $value field value
|
||||
* @return void
|
||||
*/
|
||||
public function setByPosition($pos, $value)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setData($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the object using an array.
|
||||
*
|
||||
* This is particularly useful when populating an object from one of the
|
||||
* request arrays (e.g. $_POST). This method goes through the column
|
||||
* names, checking to see whether a matching key exists in populated
|
||||
* array. If so the setByName() method is called for that column.
|
||||
*
|
||||
* You can specify the key type of the array by additionally passing one
|
||||
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
|
||||
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
|
||||
*
|
||||
* @param array $arr An array to populate the object from.
|
||||
* @param string $keyType The type of keys the array uses.
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorFilterDataPeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setData($arr[$keys[1]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Criteria object containing the values of all modified columns in this object.
|
||||
*
|
||||
* @return Criteria The Criteria object containing all modified values.
|
||||
*/
|
||||
public function buildCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AdminGeneratorFilterDataPeer::ID)) $criteria->add(AdminGeneratorFilterDataPeer::ID, $this->id);
|
||||
if ($this->isColumnModified(AdminGeneratorFilterDataPeer::DATA)) $criteria->add(AdminGeneratorFilterDataPeer::DATA, null !== $this->data && (is_array($this->data) || is_object($this->data)) ? serialize($this->data) : $this->data);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a Criteria object containing the primary key for this object.
|
||||
*
|
||||
* Unlike buildCriteria() this method includes the primary key values regardless
|
||||
* of whether or not they have been modified.
|
||||
*
|
||||
* @return Criteria The Criteria object containing value(s) for primary key(s).
|
||||
*/
|
||||
public function buildPkeyCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AdminGeneratorFilterDataPeer::ID, $this->id);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return int
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns [composite] primary key fields
|
||||
*
|
||||
* @param string $keyType
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
return array(AdminGeneratorFilterDataPeer::translateFieldName('id', BasePeer::TYPE_FIELDNAME, $keyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (id column).
|
||||
*
|
||||
* @param int $key Primary key.
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
{
|
||||
$this->setId($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contents of passed object to values from current object.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param object $copyObj An object of AdminGeneratorFilterData (or compatible) type.
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setData($this->data);
|
||||
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach($this->getAdminGeneratorFilters() as $relObj) {
|
||||
$copyObj->addAdminGeneratorFilter($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
} // if ($deepCopy)
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
$copyObj->setId(NULL); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a copy of this object that will be inserted as a new row in table when saved.
|
||||
* It creates a new object filling in the simple attributes, but skipping any primary
|
||||
* keys that are defined for the table.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @return AdminGeneratorFilterData Clone of current object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copy($deepCopy = false)
|
||||
{
|
||||
// we use get_class(), because this might be a subclass
|
||||
$clazz = get_class($this);
|
||||
$copyObj = new $clazz();
|
||||
$this->copyInto($copyObj, $deepCopy);
|
||||
return $copyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a peer instance associated with this om.
|
||||
*
|
||||
* @return string Peer class name
|
||||
*/
|
||||
public function getPeer()
|
||||
{
|
||||
return 'AdminGeneratorFilterDataPeer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary storage of collAdminGeneratorFilters to save a possible db hit in
|
||||
* the event objects are add to the collection, but the
|
||||
* complete collection is never requested.
|
||||
* @return void
|
||||
*/
|
||||
public function initAdminGeneratorFilters()
|
||||
{
|
||||
if ($this->collAdminGeneratorFilters === null) {
|
||||
$this->collAdminGeneratorFilters = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this AdminGeneratorFilterData has previously
|
||||
* been saved, it will retrieve related AdminGeneratorFilters from storage.
|
||||
* If this AdminGeneratorFilterData is new, it will return
|
||||
* an empty collection or the current collection, the criteria
|
||||
* is ignored on a new object.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @param Criteria $criteria
|
||||
* @return AdminGeneratorFilter[]
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdminGeneratorFilters($criteria = null, $con = null)
|
||||
{
|
||||
// include the Peer class
|
||||
if ($criteria === null) {
|
||||
$criteria = new Criteria();
|
||||
}
|
||||
elseif ($criteria instanceof Criteria)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
}
|
||||
|
||||
if ($this->collAdminGeneratorFilters === null) {
|
||||
if ($this->isNew()) {
|
||||
$this->collAdminGeneratorFilters = array();
|
||||
} else {
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->getId());
|
||||
|
||||
AdminGeneratorFilterPeer::addSelectColumns($criteria);
|
||||
$this->collAdminGeneratorFilters = AdminGeneratorFilterPeer::doSelect($criteria, $con);
|
||||
}
|
||||
} else {
|
||||
// criteria has no effect for a new object
|
||||
if (!$this->isNew()) {
|
||||
// the following code is to determine if a new query is
|
||||
// called for. If the criteria is the same as the last
|
||||
// one, just return the collection.
|
||||
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->getId());
|
||||
|
||||
AdminGeneratorFilterPeer::addSelectColumns($criteria);
|
||||
if (!isset($this->lastAdminGeneratorFilterCriteria) || !$this->lastAdminGeneratorFilterCriteria->equals($criteria)) {
|
||||
$this->collAdminGeneratorFilters = AdminGeneratorFilterPeer::doSelect($criteria, $con);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->lastAdminGeneratorFilterCriteria = $criteria;
|
||||
return $this->collAdminGeneratorFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AdminGeneratorFilters.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param Connection $con
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAdminGeneratorFilters($criteria = null, $distinct = false, $con = null)
|
||||
{
|
||||
// include the Peer class
|
||||
if ($criteria === null) {
|
||||
$criteria = new Criteria();
|
||||
}
|
||||
elseif ($criteria instanceof Criteria)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
}
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->getId());
|
||||
|
||||
return AdminGeneratorFilterPeer::doCount($criteria, $distinct, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a AdminGeneratorFilter object to this object
|
||||
* through the AdminGeneratorFilter foreign key attribute
|
||||
*
|
||||
* @param AdminGeneratorFilter $l AdminGeneratorFilter
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function addAdminGeneratorFilter(AdminGeneratorFilter $l)
|
||||
{
|
||||
$this->collAdminGeneratorFilters[] = $l;
|
||||
$l->setAdminGeneratorFilterData($this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this AdminGeneratorFilterData is new, it will return
|
||||
* an empty collection; or if this AdminGeneratorFilterData has previously
|
||||
* been saved, it will retrieve related AdminGeneratorFilters from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in AdminGeneratorFilterData.
|
||||
*
|
||||
* @return AdminGeneratorFilter[]
|
||||
*/
|
||||
public function getAdminGeneratorFiltersJoinsfGuardUser($criteria = null, $con = null)
|
||||
{
|
||||
// include the Peer class
|
||||
if ($criteria === null) {
|
||||
$criteria = new Criteria();
|
||||
}
|
||||
elseif ($criteria instanceof Criteria)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
}
|
||||
|
||||
if ($this->collAdminGeneratorFilters === null) {
|
||||
if ($this->isNew()) {
|
||||
$this->collAdminGeneratorFilters = array();
|
||||
} else {
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->getId());
|
||||
|
||||
$this->collAdminGeneratorFilters = AdminGeneratorFilterPeer::doSelectJoinsfGuardUser($criteria, $con);
|
||||
}
|
||||
} else {
|
||||
// the following code is to determine if a new query is
|
||||
// called for. If the criteria is the same as the last
|
||||
// one, just return the collection.
|
||||
|
||||
$criteria->add(AdminGeneratorFilterPeer::DATA_ID, $this->getId());
|
||||
|
||||
if (!isset($this->lastAdminGeneratorFilterCriteria) || !$this->lastAdminGeneratorFilterCriteria->equals($criteria)) {
|
||||
$this->collAdminGeneratorFilters = AdminGeneratorFilterPeer::doSelectJoinsfGuardUser($criteria, $con);
|
||||
}
|
||||
}
|
||||
$this->lastAdminGeneratorFilterCriteria = $criteria;
|
||||
|
||||
return $this->collAdminGeneratorFilters;
|
||||
}
|
||||
|
||||
|
||||
public function getDispatcher()
|
||||
{
|
||||
if (null === self::$dispatcher)
|
||||
{
|
||||
self::$dispatcher = stEventDispatcher::getInstance();
|
||||
}
|
||||
|
||||
return self::$dispatcher;
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
$event = $this->getDispatcher()->notifyUntil(new sfEvent($this, 'AdminGeneratorFilterData.' . $method, array('arguments' => $arguments, 'method' => $method)));
|
||||
|
||||
if ($event->isProcessed())
|
||||
{
|
||||
return $event->getReturnValue();
|
||||
}
|
||||
|
||||
if (!$callable = sfMixer::getCallable('BaseAdminGeneratorFilterData:'.$method))
|
||||
{
|
||||
throw new sfException(sprintf('Call to undefined method BaseAdminGeneratorFilterData::%s', $method));
|
||||
}
|
||||
|
||||
array_unshift($arguments, $this);
|
||||
|
||||
return call_user_func_array($callable, $arguments);
|
||||
}
|
||||
|
||||
} // BaseAdminGeneratorFilterData
|
||||
@@ -0,0 +1,677 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'st_admin_generator_filter_data' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stAdminGeneratorPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseAdminGeneratorFilterDataPeer {
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'propel';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'st_admin_generator_filter_data';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'plugins.stAdminGeneratorPlugin.lib.model.AdminGeneratorFilterData';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** the column name for the ID field */
|
||||
const ID = 'st_admin_generator_filter_data.ID';
|
||||
|
||||
/** the column name for the DATA field */
|
||||
const DATA = 'st_admin_generator_filter_data.DATA';
|
||||
|
||||
/** 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', 'Data', ),
|
||||
BasePeer::TYPE_COLNAME => array (AdminGeneratorFilterDataPeer::ID, AdminGeneratorFilterDataPeer::DATA, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'data', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'Data' => 1, ),
|
||||
BasePeer::TYPE_COLNAME => array (AdminGeneratorFilterDataPeer::ID => 0, AdminGeneratorFilterDataPeer::DATA => 1, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'data' => 1, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, )
|
||||
);
|
||||
|
||||
protected static $hydrateMethod = null;
|
||||
|
||||
protected static $postHydrateMethod = null;
|
||||
|
||||
public static function setHydrateMethod($callback)
|
||||
{
|
||||
self::$hydrateMethod = $callback;
|
||||
}
|
||||
|
||||
public static function setPostHydrateMethod($callback)
|
||||
{
|
||||
self::$postHydrateMethod = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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('plugins.stAdminGeneratorPlugin.lib.model.map.AdminGeneratorFilterDataMapBuilder');
|
||||
}
|
||||
/**
|
||||
* 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 = AdminGeneratorFilterDataPeer::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. AdminGeneratorFilterDataPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(AdminGeneratorFilterDataPeer::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(AdminGeneratorFilterDataPeer::ID);
|
||||
|
||||
$criteria->addSelectColumn(AdminGeneratorFilterDataPeer::DATA);
|
||||
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('AdminGeneratorFilterDataPeer.postAddSelectColumns')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'AdminGeneratorFilterDataPeer.postAddSelectColumns'));
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(st_admin_generator_filter_data.ID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT st_admin_generator_filter_data.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(AdminGeneratorFilterDataPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(AdminGeneratorFilterDataPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = AdminGeneratorFilterDataPeer::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 AdminGeneratorFilterData
|
||||
* @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 = AdminGeneratorFilterDataPeer::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 AdminGeneratorFilterData[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect(Criteria $criteria, $con = null)
|
||||
{
|
||||
return AdminGeneratorFilterDataPeer::populateObjects(AdminGeneratorFilterDataPeer::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)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
$criteria = clone $criteria;
|
||||
AdminGeneratorFilterDataPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
$rs = BasePeer::doSelect($criteria, $con);
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = AdminGeneratorFilterDataPeer::getOMClass();
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while($rs->next()) {
|
||||
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($rs);
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* 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 AdminGeneratorFilterDataPeer::CLASS_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a AdminGeneratorFilterData or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorFilterData 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('BaseAdminGeneratorFilterDataPeer:doInsert:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseAdminGeneratorFilterDataPeer', $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 AdminGeneratorFilterData object
|
||||
}
|
||||
|
||||
$criteria->remove(AdminGeneratorFilterDataPeer::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('BaseAdminGeneratorFilterDataPeer:doInsert:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseAdminGeneratorFilterDataPeer', $values, $con, $pk);
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an UPDATE on the database, given a AdminGeneratorFilterData or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorFilterData 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('BaseAdminGeneratorFilterDataPeer:doUpdate:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseAdminGeneratorFilterDataPeer', $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(AdminGeneratorFilterDataPeer::ID);
|
||||
$selectCriteria->add(AdminGeneratorFilterDataPeer::ID, $criteria->remove(AdminGeneratorFilterDataPeer::ID), $comparison);
|
||||
|
||||
} else { // $values is AdminGeneratorFilterData 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('BaseAdminGeneratorFilterDataPeer:doUpdate:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseAdminGeneratorFilterDataPeer', $values, $con, $ret);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the st_admin_generator_filter_data 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 += AdminGeneratorFilterDataPeer::doOnDeleteCascade(new Criteria(), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AdminGeneratorFilterDataPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a AdminGeneratorFilterData or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorFilterData 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(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof AdminGeneratorFilterData) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(AdminGeneratorFilterDataPeer::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 += AdminGeneratorFilterDataPeer::doOnDeleteCascade($criteria, $con);
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Connection $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AdminGeneratorFilterDataPeer::doSelect($criteria, $con);
|
||||
foreach($objects as $obj) {
|
||||
|
||||
|
||||
// delete related AdminGeneratorFilter objects
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(AdminGeneratorFilterPeer::DATA_ID, $obj->getId());
|
||||
$affectedRows += AdminGeneratorFilterPeer::doDelete($c, $con);
|
||||
}
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given AdminGeneratorFilterData 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 AdminGeneratorFilterData $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(AdminGeneratorFilterData $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(AdminGeneratorFilterDataPeer::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(AdminGeneratorFilterDataPeer::DATABASE_NAME, AdminGeneratorFilterDataPeer::TABLE_NAME, $columns);
|
||||
if ($res !== true) {
|
||||
$request = sfContext::getInstance()->getRequest();
|
||||
foreach ($res as $failed) {
|
||||
$col = AdminGeneratorFilterDataPeer::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 AdminGeneratorFilterData
|
||||
*/
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(AdminGeneratorFilterDataPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AdminGeneratorFilterDataPeer::ID, $pk);
|
||||
|
||||
|
||||
$v = AdminGeneratorFilterDataPeer::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.
|
||||
* @return AdminGeneratorFilterData[]
|
||||
*/
|
||||
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(AdminGeneratorFilterDataPeer::ID, $pks, Criteria::IN);
|
||||
$objs = AdminGeneratorFilterDataPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
|
||||
} // BaseAdminGeneratorFilterDataPeer
|
||||
|
||||
// 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 {
|
||||
BaseAdminGeneratorFilterDataPeer::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('plugins.stAdminGeneratorPlugin.lib.model.map.AdminGeneratorFilterDataMapBuilder');
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,825 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'st_admin_generator_user_configuration' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stAdminGeneratorPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseAdminGeneratorUserConfiguration extends BaseObject implements Persistent {
|
||||
|
||||
|
||||
protected static $dispatcher = null;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the guard_user_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $guard_user_id;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the module_namespace field.
|
||||
* @var string
|
||||
*/
|
||||
protected $module_namespace;
|
||||
|
||||
|
||||
/**
|
||||
* The value for the parameters field.
|
||||
* @var array
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @var sfGuardUser
|
||||
*/
|
||||
protected $asfGuardUser;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless validation loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [guard_user_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getGuardUserId()
|
||||
{
|
||||
|
||||
return $this->guard_user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [module_namespace] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleNamespace()
|
||||
{
|
||||
|
||||
return $this->module_namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [parameters] column value.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->id !== $v) {
|
||||
$this->id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorUserConfigurationPeer::ID;
|
||||
}
|
||||
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [guard_user_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setGuardUserId($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->guard_user_id !== $v) {
|
||||
$this->guard_user_id = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorUserConfigurationPeer::GUARD_USER_ID;
|
||||
}
|
||||
|
||||
if ($this->asfGuardUser !== null && $this->asfGuardUser->getId() !== $v) {
|
||||
$this->asfGuardUser = null;
|
||||
}
|
||||
|
||||
} // setGuardUserId()
|
||||
|
||||
/**
|
||||
* Set the value of [module_namespace] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setModuleNamespace($v)
|
||||
{
|
||||
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->module_namespace !== $v) {
|
||||
$this->module_namespace = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE;
|
||||
}
|
||||
|
||||
} // setModuleNamespace()
|
||||
|
||||
/**
|
||||
* Set the value of [parameters] column.
|
||||
*
|
||||
* @param array $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setParameters($v)
|
||||
{
|
||||
|
||||
if ($this->parameters !== $v) {
|
||||
$this->parameters = $v;
|
||||
$this->modifiedColumns[] = AdminGeneratorUserConfigurationPeer::PARAMETERS;
|
||||
}
|
||||
|
||||
} // setParameters()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
* An offset (1-based "start column") is specified so that objects can be hydrated
|
||||
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||
* for results of JOIN queries where the resultset row includes columns from two or
|
||||
* more tables.
|
||||
*
|
||||
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
|
||||
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
|
||||
* @return int next starting column
|
||||
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||
*/
|
||||
public function hydrate(ResultSet $rs, $startcol = 1)
|
||||
{
|
||||
try {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.preHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.preHydrate', array('resultset' => $rs, 'startcol' => $startcol)));
|
||||
$startcol = $event['startcol'];
|
||||
}
|
||||
|
||||
$this->id = $rs->getInt($startcol + 0);
|
||||
|
||||
$this->guard_user_id = $rs->getInt($startcol + 1);
|
||||
|
||||
$this->module_namespace = $rs->getString($startcol + 2);
|
||||
|
||||
$this->parameters = $rs->getString($startcol + 3) ? unserialize($rs->getString($startcol + 3)) : null;
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.postHydrate')) {
|
||||
$event = $this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.postHydrate', array('resultset' => $rs, 'startcol' => $startcol + 4)));
|
||||
return $event['startcol'];
|
||||
}
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 4; // 4 = AdminGeneratorUserConfigurationPeer::NUM_COLUMNS - AdminGeneratorUserConfigurationPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating AdminGeneratorUserConfiguration object", $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this object from datastore and sets delete attribute.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
* @see BaseObject::setDeleted()
|
||||
* @see BaseObject::isDeleted()
|
||||
*/
|
||||
public function delete($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("This object has already been deleted.");
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.preDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.preDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorUserConfiguration:delete:pre'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorUserConfiguration:delete:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, $this, $con);
|
||||
if ($ret)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
AdminGeneratorUserConfigurationPeer::doDelete($this, $con);
|
||||
$this->setDeleted(true);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.postDelete')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.postDelete', array('con' => $con)));
|
||||
}
|
||||
|
||||
if (sfMixer::hasCallables('BaseAdminGeneratorUserConfiguration:delete:post'))
|
||||
{
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorUserConfiguration:delete:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database. If the object is new,
|
||||
* it inserts it; otherwise an update is performed. This method
|
||||
* wraps the doSave() worker method in a transaction.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see doSave()
|
||||
*/
|
||||
public function save($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("You cannot save an object that has been deleted.");
|
||||
}
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.preSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.preSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorUserConfiguration:save:pre') as $callable)
|
||||
{
|
||||
$affectedRows = call_user_func($callable, $this, $con);
|
||||
if (is_int($affectedRows))
|
||||
{
|
||||
return $affectedRows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
$affectedRows = $this->doSave($con);
|
||||
$con->commit();
|
||||
|
||||
if (!$this->alreadyInSave) {
|
||||
if ($this->getDispatcher()->getListeners('AdminGeneratorUserConfiguration.postSave')) {
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'AdminGeneratorUserConfiguration.postSave', array('con' => $con)));
|
||||
}
|
||||
|
||||
foreach (sfMixer::getCallables('BaseAdminGeneratorUserConfiguration:save:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, $this, $con, $affectedRows);
|
||||
}
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database.
|
||||
*
|
||||
* If the object is new, it inserts it; otherwise an update is performed.
|
||||
* All related objects are also updated in this method.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||
* @throws PropelException
|
||||
* @see save()
|
||||
*/
|
||||
protected function doSave($con)
|
||||
{
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
|
||||
// We call the save method on the following object(s) if they
|
||||
// were passed to this object by their coresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->asfGuardUser !== null) {
|
||||
if ($this->asfGuardUser->isModified()) {
|
||||
$affectedRows += $this->asfGuardUser->save($con);
|
||||
}
|
||||
$this->setsfGuardUser($this->asfGuardUser);
|
||||
}
|
||||
|
||||
|
||||
// If this object has been modified, then save it to the database.
|
||||
if ($this->isModified()) {
|
||||
if ($this->isNew()) {
|
||||
$pk = AdminGeneratorUserConfigurationPeer::doInsert($this, $con);
|
||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||
// should always be true here (even though technically
|
||||
// BasePeer::doInsert() can insert multiple rows).
|
||||
|
||||
$this->setId($pk); //[IMV] update autoincrement primary key
|
||||
|
||||
$this->setNew(false);
|
||||
} else {
|
||||
$affectedRows += AdminGeneratorUserConfigurationPeer::doUpdate($this, $con);
|
||||
}
|
||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
}
|
||||
return $affectedRows;
|
||||
} // doSave()
|
||||
|
||||
/**
|
||||
* Array of ValidationFailed objects.
|
||||
* @var array ValidationFailed[]
|
||||
*/
|
||||
protected $validationFailures = array();
|
||||
|
||||
/**
|
||||
* Gets any ValidationFailed objects that resulted from last call to validate().
|
||||
*
|
||||
*
|
||||
* @return array ValidationFailed[]
|
||||
* @see validate()
|
||||
*/
|
||||
public function getValidationFailures()
|
||||
{
|
||||
return $this->validationFailures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the objects modified field values and all objects related to this table.
|
||||
*
|
||||
* If $columns is either a column name or an array of column names
|
||||
* only those columns are validated.
|
||||
*
|
||||
* @param mixed $columns Column name or an array of column names.
|
||||
* @return boolean Whether all columns pass validation.
|
||||
* @see doValidate()
|
||||
* @see getValidationFailures()
|
||||
*/
|
||||
public function validate($columns = null)
|
||||
{
|
||||
$res = $this->doValidate($columns);
|
||||
if ($res === true) {
|
||||
$this->validationFailures = array();
|
||||
return true;
|
||||
} else {
|
||||
$this->validationFailures = $res;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 aggreagated 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> objets 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 coresponding set
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->asfGuardUser !== null) {
|
||||
if (!$this->asfGuardUser->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->asfGuardUser->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AdminGeneratorUserConfigurationPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
||||
return (!empty($failureMap) ? $failureMap : true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name name
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return mixed Value of field.
|
||||
*/
|
||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorUserConfigurationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->getByPosition($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @return mixed Value of field at $pos
|
||||
*/
|
||||
public function getByPosition($pos)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getGuardUserId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getModuleNamespace();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getParameters();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the object as an array.
|
||||
*
|
||||
* You can specify the key type of the array by passing one of the class
|
||||
* type constants.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorUserConfigurationPeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getGuardUserId(),
|
||||
$keys[2] => $this->getModuleNamespace(),
|
||||
$keys[3] => $this->getParameters(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name peer name
|
||||
* @param mixed $value field value
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return void
|
||||
*/
|
||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = AdminGeneratorUserConfigurationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->setByPosition($pos, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @param mixed $value field value
|
||||
* @return void
|
||||
*/
|
||||
public function setByPosition($pos, $value)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setGuardUserId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setModuleNamespace($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setParameters($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the object using an array.
|
||||
*
|
||||
* This is particularly useful when populating an object from one of the
|
||||
* request arrays (e.g. $_POST). This method goes through the column
|
||||
* names, checking to see whether a matching key exists in populated
|
||||
* array. If so the setByName() method is called for that column.
|
||||
*
|
||||
* You can specify the key type of the array by additionally passing one
|
||||
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
|
||||
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
|
||||
*
|
||||
* @param array $arr An array to populate the object from.
|
||||
* @param string $keyType The type of keys the array uses.
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = AdminGeneratorUserConfigurationPeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setGuardUserId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setModuleNamespace($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setParameters($arr[$keys[3]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Criteria object containing the values of all modified columns in this object.
|
||||
*
|
||||
* @return Criteria The Criteria object containing all modified values.
|
||||
*/
|
||||
public function buildCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AdminGeneratorUserConfigurationPeer::ID)) $criteria->add(AdminGeneratorUserConfigurationPeer::ID, $this->id);
|
||||
if ($this->isColumnModified(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID)) $criteria->add(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, $this->guard_user_id);
|
||||
if ($this->isColumnModified(AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE)) $criteria->add(AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE, $this->module_namespace);
|
||||
if ($this->isColumnModified(AdminGeneratorUserConfigurationPeer::PARAMETERS)) $criteria->add(AdminGeneratorUserConfigurationPeer::PARAMETERS, null !== $this->parameters && (is_array($this->parameters) || is_object($this->parameters)) ? serialize($this->parameters) : $this->parameters);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a Criteria object containing the primary key for this object.
|
||||
*
|
||||
* Unlike buildCriteria() this method includes the primary key values regardless
|
||||
* of whether or not they have been modified.
|
||||
*
|
||||
* @return Criteria The Criteria object containing value(s) for primary key(s).
|
||||
*/
|
||||
public function buildPkeyCriteria()
|
||||
{
|
||||
$criteria = new Criteria(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::ID, $this->id);
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, $this->guard_user_id);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the composite primary key for this object.
|
||||
* The array elements will be in same order as specified in XML.
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return array($this->getId(), $this->getGuardUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns [composite] primary key fields
|
||||
*
|
||||
* @param string $keyType
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKeyFields($keyType = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
return array(AdminGeneratorUserConfigurationPeer::translateFieldName('id', BasePeer::TYPE_FIELDNAME, $keyType), AdminGeneratorUserConfigurationPeer::translateFieldName('guard_user_id', BasePeer::TYPE_FIELDNAME, $keyType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the [composite] primary key.
|
||||
*
|
||||
* @param array $keys The elements of the composite key (order must match the order in XML file).
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($keys)
|
||||
{
|
||||
|
||||
$this->setId($keys[0]);
|
||||
|
||||
$this->setGuardUserId($keys[1]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contents of passed object to values from current object.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param object $copyObj An object of AdminGeneratorUserConfiguration (or compatible) type.
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setModuleNamespace($this->module_namespace);
|
||||
|
||||
$copyObj->setParameters($this->parameters);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
$copyObj->setId(NULL); // this is a pkey column, so set to default value
|
||||
|
||||
$copyObj->setGuardUserId(NULL); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a copy of this object that will be inserted as a new row in table when saved.
|
||||
* It creates a new object filling in the simple attributes, but skipping any primary
|
||||
* keys that are defined for the table.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @return AdminGeneratorUserConfiguration Clone of current object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copy($deepCopy = false)
|
||||
{
|
||||
// we use get_class(), because this might be a subclass
|
||||
$clazz = get_class($this);
|
||||
$copyObj = new $clazz();
|
||||
$this->copyInto($copyObj, $deepCopy);
|
||||
return $copyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a peer instance associated with this om.
|
||||
*
|
||||
* @return string Peer class name
|
||||
*/
|
||||
public function getPeer()
|
||||
{
|
||||
return 'AdminGeneratorUserConfigurationPeer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a sfGuardUser object.
|
||||
*
|
||||
* @param sfGuardUser $v
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setsfGuardUser($v)
|
||||
{
|
||||
|
||||
|
||||
if ($v === null) {
|
||||
$this->setGuardUserId(NULL);
|
||||
} else {
|
||||
$this->setGuardUserId($v->getId());
|
||||
}
|
||||
|
||||
|
||||
$this->asfGuardUser = $v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated sfGuardUser object
|
||||
*
|
||||
* @param Connection Optional Connection object.
|
||||
* @return sfGuardUser The associated sfGuardUser object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getsfGuardUser($con = null)
|
||||
{
|
||||
if ($this->asfGuardUser === null && ($this->guard_user_id !== null)) {
|
||||
// include the related Peer class
|
||||
$this->asfGuardUser = sfGuardUserPeer::retrieveByPK($this->guard_user_id, $con);
|
||||
|
||||
/* The following can be used instead of the line above to
|
||||
guarantee the related object contains a reference
|
||||
to this object, but this level of coupling
|
||||
may be undesirable in many circumstances.
|
||||
As it can lead to a db query with many results that may
|
||||
never be used.
|
||||
$obj = sfGuardUserPeer::retrieveByPK($this->guard_user_id, $con);
|
||||
$obj->addsfGuardUsers($this);
|
||||
*/
|
||||
}
|
||||
return $this->asfGuardUser;
|
||||
}
|
||||
|
||||
|
||||
public function getDispatcher()
|
||||
{
|
||||
if (null === self::$dispatcher)
|
||||
{
|
||||
self::$dispatcher = stEventDispatcher::getInstance();
|
||||
}
|
||||
|
||||
return self::$dispatcher;
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
$event = $this->getDispatcher()->notifyUntil(new sfEvent($this, 'AdminGeneratorUserConfiguration.' . $method, array('arguments' => $arguments, 'method' => $method)));
|
||||
|
||||
if ($event->isProcessed())
|
||||
{
|
||||
return $event->getReturnValue();
|
||||
}
|
||||
|
||||
if (!$callable = sfMixer::getCallable('BaseAdminGeneratorUserConfiguration:'.$method))
|
||||
{
|
||||
throw new sfException(sprintf('Call to undefined method BaseAdminGeneratorUserConfiguration::%s', $method));
|
||||
}
|
||||
|
||||
array_unshift($arguments, $this);
|
||||
|
||||
return call_user_func_array($callable, $arguments);
|
||||
}
|
||||
|
||||
} // BaseAdminGeneratorUserConfiguration
|
||||
@@ -0,0 +1,841 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'st_admin_generator_user_configuration' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stAdminGeneratorPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseAdminGeneratorUserConfigurationPeer {
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'propel';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'st_admin_generator_user_configuration';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'plugins.stAdminGeneratorPlugin.lib.model.AdminGeneratorUserConfiguration';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 4;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** the column name for the ID field */
|
||||
const ID = 'st_admin_generator_user_configuration.ID';
|
||||
|
||||
/** the column name for the GUARD_USER_ID field */
|
||||
const GUARD_USER_ID = 'st_admin_generator_user_configuration.GUARD_USER_ID';
|
||||
|
||||
/** the column name for the MODULE_NAMESPACE field */
|
||||
const MODULE_NAMESPACE = 'st_admin_generator_user_configuration.MODULE_NAMESPACE';
|
||||
|
||||
/** the column name for the PARAMETERS field */
|
||||
const PARAMETERS = 'st_admin_generator_user_configuration.PARAMETERS';
|
||||
|
||||
/** 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', 'GuardUserId', 'ModuleNamespace', 'Parameters', ),
|
||||
BasePeer::TYPE_COLNAME => array (AdminGeneratorUserConfigurationPeer::ID, AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE, AdminGeneratorUserConfigurationPeer::PARAMETERS, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'guard_user_id', 'module_namespace', 'parameters', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'GuardUserId' => 1, 'ModuleNamespace' => 2, 'Parameters' => 3, ),
|
||||
BasePeer::TYPE_COLNAME => array (AdminGeneratorUserConfigurationPeer::ID => 0, AdminGeneratorUserConfigurationPeer::GUARD_USER_ID => 1, AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE => 2, AdminGeneratorUserConfigurationPeer::PARAMETERS => 3, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'guard_user_id' => 1, 'module_namespace' => 2, 'parameters' => 3, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
protected static $hydrateMethod = null;
|
||||
|
||||
protected static $postHydrateMethod = null;
|
||||
|
||||
public static function setHydrateMethod($callback)
|
||||
{
|
||||
self::$hydrateMethod = $callback;
|
||||
}
|
||||
|
||||
public static function setPostHydrateMethod($callback)
|
||||
{
|
||||
self::$postHydrateMethod = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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('plugins.stAdminGeneratorPlugin.lib.model.map.AdminGeneratorUserConfigurationMapBuilder');
|
||||
}
|
||||
/**
|
||||
* 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 = AdminGeneratorUserConfigurationPeer::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. AdminGeneratorUserConfigurationPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(AdminGeneratorUserConfigurationPeer::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(AdminGeneratorUserConfigurationPeer::ID);
|
||||
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID);
|
||||
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::MODULE_NAMESPACE);
|
||||
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::PARAMETERS);
|
||||
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('AdminGeneratorUserConfigurationPeer.postAddSelectColumns')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'AdminGeneratorUserConfigurationPeer.postAddSelectColumns'));
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(st_admin_generator_user_configuration.ID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT st_admin_generator_user_configuration.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(AdminGeneratorUserConfigurationPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = AdminGeneratorUserConfigurationPeer::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 AdminGeneratorUserConfiguration
|
||||
* @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 = AdminGeneratorUserConfigurationPeer::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 AdminGeneratorUserConfiguration[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect(Criteria $criteria, $con = null)
|
||||
{
|
||||
return AdminGeneratorUserConfigurationPeer::populateObjects(AdminGeneratorUserConfigurationPeer::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)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
$criteria = clone $criteria;
|
||||
AdminGeneratorUserConfigurationPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
$rs = BasePeer::doSelect($criteria, $con);
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = AdminGeneratorUserConfigurationPeer::getOMClass();
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while($rs->next()) {
|
||||
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($rs);
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related sfGuardUser 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 doCountJoinsfGuardUser(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(AdminGeneratorUserConfigurationPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, sfGuardUserPeer::ID);
|
||||
|
||||
$rs = AdminGeneratorUserConfigurationPeer::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 AdminGeneratorUserConfiguration objects pre-filled with their sfGuardUser objects.
|
||||
*
|
||||
* @return AdminGeneratorUserConfiguration[] Array of AdminGeneratorUserConfiguration objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinsfGuardUser(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGeneratorUserConfigurationPeer::addSelectColumns($c);
|
||||
|
||||
sfGuardUserPeer::addSelectColumns($c);
|
||||
|
||||
$c->addJoin(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, sfGuardUserPeer::ID);
|
||||
$rs = AdminGeneratorUserConfigurationPeer::doSelectRs($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$obj1 = new AdminGeneratorUserConfiguration();
|
||||
$startcol = $obj1->hydrate($rs);
|
||||
if ($obj1->getGuardUserId())
|
||||
{
|
||||
|
||||
$obj2 = new sfGuardUser();
|
||||
$obj2->hydrate($rs, $startcol);
|
||||
$obj2->addAdminGeneratorUserConfiguration($obj1);
|
||||
}
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $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(AdminGeneratorUserConfigurationPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(AdminGeneratorUserConfigurationPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, sfGuardUserPeer::ID);
|
||||
|
||||
$rs = AdminGeneratorUserConfigurationPeer::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 AdminGeneratorUserConfiguration objects pre-filled with all related objects.
|
||||
*
|
||||
* @return AdminGeneratorUserConfiguration[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAll(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGeneratorUserConfigurationPeer::addSelectColumns($c);
|
||||
$startcol2 = (AdminGeneratorUserConfigurationPeer::NUM_COLUMNS - AdminGeneratorUserConfigurationPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
|
||||
|
||||
sfGuardUserPeer::addSelectColumns($c);
|
||||
$startcol3 = $startcol2 + sfGuardUserPeer::NUM_COLUMNS;
|
||||
|
||||
$c->addJoin(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, sfGuardUserPeer::ID);
|
||||
|
||||
$rs = BasePeer::doSelect($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$omClass = AdminGeneratorUserConfigurationPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::import($omClass);
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($rs);
|
||||
|
||||
|
||||
// Add objects for joined sfGuardUser rows
|
||||
|
||||
$omClass = sfGuardUserPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::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->getsfGuardUser(); // CHECKME
|
||||
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
|
||||
$newObject = false;
|
||||
$temp_obj2->addAdminGeneratorUserConfiguration($obj1); // CHECKME
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($newObject) {
|
||||
$obj2->initAdminGeneratorUserConfigurations();
|
||||
$obj2->addAdminGeneratorUserConfiguration($obj1);
|
||||
}
|
||||
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AdminGeneratorUserConfigurationPeer::CLASS_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a AdminGeneratorUserConfiguration or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorUserConfiguration 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('BaseAdminGeneratorUserConfigurationPeer:doInsert:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseAdminGeneratorUserConfigurationPeer', $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 AdminGeneratorUserConfiguration object
|
||||
}
|
||||
|
||||
$criteria->remove(AdminGeneratorUserConfigurationPeer::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('BaseAdminGeneratorUserConfigurationPeer:doInsert:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseAdminGeneratorUserConfigurationPeer', $values, $con, $pk);
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an UPDATE on the database, given a AdminGeneratorUserConfiguration or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorUserConfiguration 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('BaseAdminGeneratorUserConfigurationPeer:doUpdate:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseAdminGeneratorUserConfigurationPeer', $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(AdminGeneratorUserConfigurationPeer::ID);
|
||||
$selectCriteria->add(AdminGeneratorUserConfigurationPeer::ID, $criteria->remove(AdminGeneratorUserConfigurationPeer::ID), $comparison);
|
||||
|
||||
$comparison = $criteria->getComparison(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID);
|
||||
$selectCriteria->add(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, $criteria->remove(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID), $comparison);
|
||||
|
||||
} else { // $values is AdminGeneratorUserConfiguration 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('BaseAdminGeneratorUserConfigurationPeer:doUpdate:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseAdminGeneratorUserConfigurationPeer', $values, $con, $ret);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the st_admin_generator_user_configuration 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(AdminGeneratorUserConfigurationPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a AdminGeneratorUserConfiguration or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or AdminGeneratorUserConfiguration 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(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof AdminGeneratorUserConfiguration) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey
|
||||
// values
|
||||
if(count($values) == count($values, COUNT_RECURSIVE))
|
||||
{
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
$vals = array();
|
||||
foreach($values as $value)
|
||||
{
|
||||
|
||||
$vals[0][] = $value[0];
|
||||
$vals[1][] = $value[1];
|
||||
}
|
||||
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::ID, $vals[0], Criteria::IN);
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, $vals[1], 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 AdminGeneratorUserConfiguration 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 AdminGeneratorUserConfiguration $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(AdminGeneratorUserConfiguration $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(AdminGeneratorUserConfigurationPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(AdminGeneratorUserConfigurationPeer::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(AdminGeneratorUserConfigurationPeer::DATABASE_NAME, AdminGeneratorUserConfigurationPeer::TABLE_NAME, $columns);
|
||||
if ($res !== true) {
|
||||
$request = sfContext::getInstance()->getRequest();
|
||||
foreach ($res as $failed) {
|
||||
$col = AdminGeneratorUserConfigurationPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
|
||||
$request->setError($col, $failed->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve object using using composite pkey values.
|
||||
* @param int $id
|
||||
@param int $guard_user_id
|
||||
|
||||
* @param Connection $con
|
||||
* @return AdminGeneratorUserConfiguration
|
||||
*/
|
||||
public static function retrieveByPK( $id, $guard_user_id, $con = null) {
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::ID, $id);
|
||||
$criteria->add(AdminGeneratorUserConfigurationPeer::GUARD_USER_ID, $guard_user_id);
|
||||
$v = AdminGeneratorUserConfigurationPeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) ? $v[0] : null;
|
||||
}
|
||||
} // BaseAdminGeneratorUserConfigurationPeer
|
||||
|
||||
// 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 {
|
||||
BaseAdminGeneratorUserConfigurationPeer::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('plugins.stAdminGeneratorPlugin.lib.model.map.AdminGeneratorUserConfigurationMapBuilder');
|
||||
}
|
||||
Reference in New Issue
Block a user