public function executeTag() { $this->book = sfDoctrine::queryFrom('Book')->from('Book.Tags')->where('Book.id = ? ',array($this->getRequestParameter('id'),false))->execute()->getFirst(); $this->tags = sfDoctrine::queryFrom('Tag')->where('Tag.is_private = ?',false)->orderby('Tag.name')->execute(); if($this->getRequest()->getMethod() == sfRequest::POST) { $this->book = sfDoctrine::queryFrom('Book')->where('Book.id = ? ',array($this->getRequestParameter('id'),false))->execute()->getFirst(); $tags = $this->getRequestParameter('tags'); sfLogger::getInstance()->debug('Type: '.gettype($tags)); foreach($tags as $tag) { foreach($this->tags as $t_obj) { if($t_obj->get('id')==$tag) { $this->book->Tags[] = $t_obj; break; } } } $this->book->save(); } }