This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » Called to undefined method error
Called to undefined method error [message #102727] Mon, 19 July 2010 10:42
xare  is currently offline xare
Messages: 14
Registered: June 2010
Junior Member
Hello I thought this would be easier to solve but I just do not get it.

I run the following code.

  public function executeBrowseCategory(sfWebRequest $request)
    {
        $this->forwardUnless($request->hasParameter('cat_id'), 'talent', 'browse');
        $cat_id = intval($request->getParameter('cat_id'));
        $culture = $this->getUser()->getCulture();
        $c = new Criteria();
        $c->add(CategoryI18nPeer::ID, $cat_id);
        $c->add(CategoryI18nPeer::CULTURE, $culture);
        $category = CategoryI18nPeer::doSelectOne($c);  //retrieveByPK($cat_id);
        $this->forwardUnless($category, 'talent', 'browse');

        $this->categoryName = $category->getName();


the function is filtering a list of users according to the category they belong to.

We want to obtain the name of the category which we obtain via
CategoryI18nPeer.

The table CategoryI18n contains the column called name. But the error reads as:

Call to undefined method BaseCategory::getName

So this raise to me two questions. The $category object which is generated by the CategoryI18nPeer class, why would it look for a function in the BaseCategory class and not in the BaseCategoryI18N where the object was generated?

The BaseCategoryI18nPeer::doSelectOne($c) performs the following way:

public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = CategoryI18nPeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}


Any help would be welcome.

Thanks


Previous Topic:sfDoctrineGuardPlugin - check if browser is just closed (user doesn't logout)
Next Topic:how to print a pdf file
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software