can add a new list item using the template.

set a default item template

working on sql to get a table with unified columns for file md and manually entered metadata without a file.
This commit is contained in:
Naomi 2013-07-30 19:24:05 -04:00
parent 06e21029d0
commit 7ca3048f36
13 changed files with 456 additions and 163 deletions

View file

@ -39,7 +39,8 @@ class CcPlayoutHistoryTemplateTableMap extends TableMap {
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('TEMPLATE_NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 35, null);
// validators
} // initialize()

View file

@ -31,10 +31,16 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
protected $id;
/**
* The value for the template_name field.
* The value for the name field.
* @var string
*/
protected $template_name;
protected $name;
/**
* The value for the type field.
* @var string
*/
protected $type;
/**
* @var array CcPlayoutHistoryTemplateField[] Collection to store aggregation of CcPlayoutHistoryTemplateField objects.
@ -66,13 +72,23 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
}
/**
* Get the [template_name] column value.
* Get the [name] column value.
*
* @return string
*/
public function getDbName()
{
return $this->template_name;
return $this->name;
}
/**
* Get the [type] column value.
*
* @return string
*/
public function getDbType()
{
return $this->type;
}
/**
@ -96,7 +112,7 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
} // setDbId()
/**
* Set the value of [template_name] column.
* Set the value of [name] column.
*
* @param string $v new value
* @return CcPlayoutHistoryTemplate The current object (for fluent API support)
@ -107,14 +123,34 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
$v = (string) $v;
}
if ($this->template_name !== $v) {
$this->template_name = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME;
if ($this->name !== $v) {
$this->name = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::NAME;
}
return $this;
} // setDbName()
/**
* Set the value of [type] column.
*
* @param string $v new value
* @return CcPlayoutHistoryTemplate The current object (for fluent API support)
*/
public function setDbType($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->type !== $v) {
$this->type = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::TYPE;
}
return $this;
} // setDbType()
/**
* Indicates whether the columns in this object are only set to default values.
*
@ -148,7 +184,8 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->template_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->resetModified();
$this->setNew(false);
@ -157,7 +194,7 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
$this->ensureConsistency();
}
return $startcol + 2; // 2 = CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 3; // 3 = CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistoryTemplate object", $e);
@ -480,6 +517,9 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
case 1:
return $this->getDbName();
break;
case 2:
return $this->getDbType();
break;
default:
return null;
break;
@ -505,6 +545,7 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbName(),
$keys[2] => $this->getDbType(),
);
return $result;
}
@ -542,6 +583,9 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
case 1:
$this->setDbName($value);
break;
case 2:
$this->setDbType($value);
break;
} // switch()
}
@ -568,6 +612,7 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbType($arr[$keys[2]]);
}
/**
@ -580,7 +625,8 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
$criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME, $this->template_name);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::NAME, $this->name);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplatePeer::TYPE, $this->type);
return $criteria;
}
@ -642,7 +688,8 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setDbName($this->template_name);
$copyObj->setDbName($this->name);
$copyObj->setDbType($this->type);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@ -815,7 +862,8 @@ abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persi
public function clear()
{
$this->id = null;
$this->template_name = null;
$this->name = null;
$this->type = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();

View file

@ -26,7 +26,7 @@ abstract class BaseCcPlayoutHistoryTemplatePeer {
const TM_CLASS = 'CcPlayoutHistoryTemplateTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 2;
const NUM_COLUMNS = 3;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -34,8 +34,11 @@ abstract class BaseCcPlayoutHistoryTemplatePeer {
/** the column name for the ID field */
const ID = 'cc_playout_history_template.ID';
/** the column name for the TEMPLATE_NAME field */
const TEMPLATE_NAME = 'cc_playout_history_template.TEMPLATE_NAME';
/** the column name for the NAME field */
const NAME = 'cc_playout_history_template.NAME';
/** the column name for the TYPE field */
const TYPE = 'cc_playout_history_template.TYPE';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryTemplate objects.
@ -53,12 +56,12 @@ abstract class BaseCcPlayoutHistoryTemplatePeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_NAME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_NAME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'template_name', ),
BasePeer::TYPE_NUM => array (0, 1, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbType', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbType', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'type', ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
@ -68,12 +71,12 @@ abstract class BaseCcPlayoutHistoryTemplatePeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_NAME => 1, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_NAME' => 1, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_name' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbType' => 2, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbType' => 2, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::TYPE => 2, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TYPE' => 2, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'type' => 2, ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
@ -146,10 +149,12 @@ abstract class BaseCcPlayoutHistoryTemplatePeer {
{
if (null === $alias) {
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TYPE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_NAME');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.TYPE');
}
}

View file

@ -7,10 +7,12 @@
*
*
* @method CcPlayoutHistoryTemplateQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryTemplateQuery orderByDbName($order = Criteria::ASC) Order by the template_name column
* @method CcPlayoutHistoryTemplateQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcPlayoutHistoryTemplateQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
* @method CcPlayoutHistoryTemplateQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryTemplateQuery groupByDbName() Group by the template_name column
* @method CcPlayoutHistoryTemplateQuery groupByDbName() Group by the name column
* @method CcPlayoutHistoryTemplateQuery groupByDbType() Group by the type column
*
* @method CcPlayoutHistoryTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -24,10 +26,12 @@
* @method CcPlayoutHistoryTemplate findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query, or a new CcPlayoutHistoryTemplate object populated from the query conditions when no match is found
*
* @method CcPlayoutHistoryTemplate findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplate filtered by the id column
* @method CcPlayoutHistoryTemplate findOneByDbName(string $template_name) Return the first CcPlayoutHistoryTemplate filtered by the template_name column
* @method CcPlayoutHistoryTemplate findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplate filtered by the name column
* @method CcPlayoutHistoryTemplate findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplate filtered by the type column
*
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplate objects filtered by the id column
* @method array findByDbName(string $template_name) Return CcPlayoutHistoryTemplate objects filtered by the template_name column
* @method array findByDbName(string $name) Return CcPlayoutHistoryTemplate objects filtered by the name column
* @method array findByDbType(string $type) Return CcPlayoutHistoryTemplate objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
@ -155,7 +159,7 @@ abstract class BaseCcPlayoutHistoryTemplateQuery extends ModelCriteria
}
/**
* Filter the query on the template_name column
* Filter the query on the name column
*
* @param string $dbName The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
@ -173,7 +177,29 @@ abstract class BaseCcPlayoutHistoryTemplateQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME, $dbName, $comparison);
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the type column
*
* @param string $dbType The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function filterByDbType($dbType = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbType)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbType)) {
$dbType = str_replace('*', '%', $dbType);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::TYPE, $dbType, $comparison);
}
/**