This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Day 13-14 mysterious problems with tags

Discussion around this tutorial for symfony 1.0.x

Day 13-14 mysterious problems with tags

by cestcri » Tue Aug 14, 2007 12:31 am

In only a few days I became a big Symfony fan, excellent work and beautiful tutorial. Thanks a million.

Although it's quite tough to complete the (sometimes outdated) tutorials with a current symfony version 1.0.6 on a Windows NT 5.1 build 2600 with Apache 2.2.4, PHP 5.2.3, Zend Engine 2.2.0, and MySQL 5.0.45 (XAMP 1.6.3a).

I could fight myself through the tutorials until day 13, the only problem being some routing problems (I seem to have constant troubles with the routing.yml) resulting in 404. I also lost my XAMPP start page, askeet totally took the localhost over. Anyway, the project advanced well and functions great.

But what did I wrong with the tags? This feature introduced on day 12 and further developed on day 13 causes tons of problems. The first one:

in module sidebar actions in components.class.php, the line

$this->question = QuestionPeer::getQuestionFromTitle($this->getRequestParameter('stripped_title'));

of function executeQuestion doesn't get the question. Hence the sidebar produces a

Fatal error: Call to a member function getTags() on a non-object in D:\xampp\htdocs\askeet\apps\frontend\modules\sidebar\templat es\_question.php on line 6

I double-checked everything, and compared it to svn's trunk version of askeet. I'd love to get some input from you, further problem specifications will follow (as for example questions about the test routines, which do not seem to work at all under current versions) once I have a feedback.

Thanks a lot, and keep up the good work.

Christian
cestcri
Faithful Member
 
Posts: 232
Joined: Tue Aug 14, 2007 12:03 am
Location: Paris

Re: Day 13-14 mysterious problems with tags

by JasonTC » Tue Aug 26, 2008 8:29 pm

It appears that you have omitted the getTags method from the Question class (/lib/model/Question.php):

Code: Select all
public function getTags()
{
  $c = new Criteria();
  $c->clearSelectColumns();
  $c->addSelectColumn(QuestionTagPeer::NORMALIZED_TAG);
  $c->add(QuestionTagPeer::QUESTION_ID, $this->getId());
  $c->setDistinct();

  $c->addAscendingOrderByColumn(QuestionTagPeer::NORMALIZED_TAG);

  $tags = array();
  $rs = QuestionTagPeer::doSelectRS($c);
  while ($rs->next())
  {
    $tags[] = $rs->getString(1);
  }

  return $tags;
}


I had another problem with tags. The routing wasn't working correctly. Turns out my problem was that I had my tag routing rules below the default rules and they needed to be above. Hopefully that helps somebody.
JasonTC
Faithful Member
 
Posts: 490
Joined: Mon Oct 16, 2006 9:00 pm
Location: Grand Rapids, MI