本文整理汇总了PHP中Type::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getId方法的具体用法?PHP Type::getId怎么用?PHP Type::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formObject
public function formObject()
{
$model = new Type($this->data->id);
$this->data->forUpdate = $this->data->id != '';
$this->data->object = $model->getData();
$this->data->title = $this->data->forUpdate ? $model->getDescription() : _M("New Type");
$this->data->save = "@fnbr20/admin/type/save/" . $model->getId() . '|formObject';
$this->data->delete = "@fnbr20/admin/type/delete/" . $model->getId() . '|formObject';
$this->render();
}
示例2: update
public function update(Type $t)
{
$q = $this->_db->prepare('UPDATE Types SET libelle= :libelle WHERE id = :id');
$q->bindValue(':id', $t->getId(), PDO::PARAM_INT);
$q->bindValue(':libelle', $t->getLibelle(), PDO::PARAM_STR);
$q->execute();
}
示例3: flush
/**
*
* @param Type $type
* @return int id of the Type inserted in base. False if it didn't work.
*/
public static function flush($type)
{
$typeId = $type->getId();
$typeName = $type->getTypeName();
if ($typeId > 0) {
$sql = 'UPDATE type t SET ' . 't.type_name = ?, ' . 'WHERE t.id_type = ?';
$params = array('si', &$typeName, $typeId);
} else {
$sql = 'INSERT INTO type ' . '(type_name) ' . 'VALUES(?) ';
$params = array('s' & $typeName);
}
$idInsert = BaseSingleton::insertOrEdit($sql, $params);
if ($idInsert !== false && $typeId > 0) {
$idInsert = $typeId;
}
return $idInsert;
}
示例4: updateType
public function updateType(Type $type)
{
try {
if ($type != null && $type->getId() == null || $type == -1) {
return false;
}
if (!parent::getBdd()->inTransaction()) {
parent::getBdd()->beginTransaction();
}
$query = "UPDATE TYPE SET label = :label WHERE id = :id";
$request = parent::getBdd()->prepare($query);
$request->bindParam(':id', $type->getId());
$request->bindParam(':label', $type->getLabel());
$request->execute();
parent::getBdd()->commit();
$request->closeCursor();
return true;
} catch (Exception $e) {
error_log($e->getMessage());
}
return false;
}
示例5: setType
/**
* Declares an association between this object and a Type object.
*
* @param Type $v
* @return Customer The current object (for fluent API support)
* @throws PropelException
*/
public function setType(Type $v = null)
{
if ($v === null) {
$this->setTypeId(NULL);
} else {
$this->setTypeId($v->getId());
}
$this->aType = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Type object, it will not be re-added.
if ($v !== null) {
$v->addCustomer($this);
}
return $this;
}
示例6: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Type $value A Type object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Type $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例7: Type
function test_find()
{
//Arrange
$descript = "Event Keepsakes";
$descript2 = "Antiques";
$test_Type = new Type($descript);
$test_Type->save();
$test_Type2 = new Type($descript2);
$test_Type2->save();
//Act
$result = Type::find($test_Type->getId());
//Assert
$this->assertEquals($test_Type, $result);
}