本文整理汇总了PHP中Forum::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::getId方法的具体用法?PHP Forum::getId怎么用?PHP Forum::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inserir
public function inserir(Forum $forum)
{
//Objetivo deste metodo é inserir um objeto no banco, fazendo-o ter persistencia.
//utilizaremos a abstracao do SQL da classe TsqlInstruction
//1. Foreach dos atributos . PRa cada existencia de atributo é um valor a ser adicionado.
$instrucao = new TSqlInsert();
$instrucao->setEntity("forum");
if ($forum->getId() != null) {
$instrucao->setRowData("id", $forum->getId());
}
if ($forum->getTitulo() != null) {
$instrucao->setRowData("titulo", $forum->getTitulo());
}
if ($forum->getCorpo() != null) {
$instrucao->setRowData("corpo", $forum->getCorpo());
}
if ($forum->getUsuario() != null) {
$instrucao->setRowData("usuario", $forum->getUsuario());
}
echo $instrucao->getInstruction();
if ($this->Conexao->query($instrucao->getInstruction())) {
return true;
} else {
return false;
}
}
示例2: bindTopic
/**
* Permet de Charger tout les topics d'un forum
* @param forum Forum dont on doit charger les topics
* @since 1.0.0
*/
public function bindTopic(Forum $forum)
{
$sql = "SELECT topic_id id, topic_titre titre, topic_vu vu, topic_genre genre\n\t\t\t\tFROM topic\n\t\t\t\tWHERE id_forum = :id";
$id_forum = $forum->getId();
$req = $this->bdd->prepare($sql);
$req->bindParam(":id", $id_forum);
$res = $req->execute();
if (!$res) {
return false;
}
$topics = $req->fetchAll(PDO::FETCH_OBJ);
foreach ($topics as $topic) {
$forum->addTopic(new Topic($topic->id, $topic->titre, NULL, $topic->vu, $topic->genre));
}
}
示例3: 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 Forum $value A Forum object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Forum $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}