public function executeDelete() { $post = PostPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($post); $post->setDeleted(true); $post->save(); $this->redirect('post/list'); }
/** * Get the associated Post object * * @param PropelPDO Optional Connection object. * @return Post The associated Post object. * @throws PropelException */ public function getPost(PropelPDO $con = null) { if ($this->aPost === null && $this->post_id !== null) { $this->aPost = PostPeer::retrieveByPk($this->post_id); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aPost->addComments($this); */ } return $this->aPost; }
<?php use_helper('MyAvatar', 'Javascript'); $post = PostPeer::retrieveByPk($object['ID']); $poster = UserPeer::retrieveByPK($post->getPosterId()); $thread = $post->getThreadId(); ?> <div class="entry"> <?php if ($poster->getPicture() != '') { ?> <?php echo avatar_tag_for_user($poster); ?> <?php } else { ?> <img src="<?php echo image_path('dev/emptyprofile.gif', false); ?> " alt="" /> <?php } ?> <div class="container"> <div> <?php $sLink = 'Posted by: ' . $poster->getName() . ' - Inside ' . $object['NAME']; echo link_to($sLink, 'forum/thread?thread_id=' . $post->getThreadId(), array('class' => 'name'));