本文整理汇总了PHP中CategoryPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryPeer::retrieveByPK方法的具体用法?PHP CategoryPeer::retrieveByPK怎么用?PHP CategoryPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryPeer
的用法示例。
在下文中一共展示了CategoryPeer::retrieveByPK方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAddArticleAndSave
public function executeAddArticleAndSave(sfWebRequest $request)
{
$article = new Article();
$article->setTitle(__METHOD__ . '()');
$category = CategoryPeer::retrieveByPK($request->getParameter('category_id'));
$category->addArticle($article);
$category->save();
return sfView::NONE;
}
示例2: executeListArticle
public function executeListArticle(sfWebRequest $request)
{
$this->categories = CategoryPeer::getActiveCategories();
$this->current_category = CategoryPeer::retrieveByPK($request->getParameter('id'));
$this->forward404If(!$this->current_category);
$this->articles = ArticlePeer::getActiveArticles($this->current_category->getId());
$this->paths = array();
$this->paths[] = array('text' => $this->current_category->getName(), 'link' => $this->getController()->genUrl('sophiaStore/listArticle?id=' . $this->current_category->getId()));
$pager = new sfPropelPager('Article', 10);
$pager->setCriteria(new Criteria());
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
}
示例3: executeShowForum
/**
* The component to display a single forum (i.e. the threads in it)
*/
public function executeShowForum()
{
$this->category = CategoryPeer::retrieveByPK($this->forumID);
if ($this->category == NULL) {
$this->category = ForumPeer::retrieveByPK($this->forumID);
}
$c = ThreadPeer::getCriteriaForCategory($this->forumID);
$pager = new sfPropelPager('Thread', 10);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$raykuPager = new RaykuPagerRenderer($pager);
$raykuPager->setBaseUrl('@view_page?forum_id=' . $this->category->getId());
$this->raykuPager = $raykuPager;
}
示例4: executeNewThread
public function executeNewThread()
{
$this->User = $this->getUser()->getRaykuUser();
if (!empty($_COOKIE['redirection'])) {
$this->getResponse()->setCookie("redirection", "", time() - 600, '/', sfConfig::get('app_cookies_domain'));
}
$c = new Criteria();
$c->add(ForumPeer::TYPE, 0);
$this->publicforums = ForumPeer::doSelect($c);
$this->category = CategoryPeer::retrieveByPK($this->getRequestParameter('forum_id'));
if (!$this->category instanceof Category) {
$this->category = ForumPeer::retrieveByPK($this->getRequestParameter('forum_id'));
}
$this->allcategories = CategoryPeer::doSelect($c = new Criteria());
$user = $this->getUser()->getRaykuUser();
if ($this->getRequestParameter('thread_title') != '') {
$theard_title_len = strlen($this->getRequestParameter('thread_title'));
$theard_body_len = strlen(strip_tags($this->getRequestParameter('post_body')));
if ($theard_title_len >= 10 and $theard_body_len >= 10) {
$school_grade = $this->getRequestParameter('school_grade');
$tags = $this->getRequestParameter('tags');
$arrayoftags = explode(',', $tags);
foreach ($arrayoftags as $tag) {
if ($tag == 'I') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'a') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'about') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'an') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'are') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'as') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'at') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'be') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'by') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'com') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'de') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'en') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'for') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'from') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'how') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'in') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'is') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'it') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'la') {
$this->msg = $tag . ' is a stop word, please add the proper tag';
return sfView::SUCCESS;
}
if ($tag == 'of') {
//.........这里部分代码省略.........
示例5: getCategory
public function getCategory($con = null)
{
if ($this->aCategory === null && $this->category_id !== null) {
include_once 'lib/model/om/BaseCategoryPeer.php';
$this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con);
}
return $this->aCategory;
}
示例6: subscribeExpertToCategories
private function subscribeExpertToCategories($categories, User $user)
{
if (!is_array($categories)) {
return;
}
foreach ($categories as $categoryid) {
$category = CategoryPeer::retrieveByPK($categoryid);
if (!$category) {
continue;
}
$expertcat = new ExpertCategory();
$expertcat->setUser($user);
$expertcat->setCategory($category);
$expertcat->save();
}
}
示例7: getCategory
public function getCategory($con = null)
{
if ($this->aCategory === null && $this->category_id !== null) {
$this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con);
}
return $this->aCategory;
}