> If there is only one filepath, add $c->setLimit(1) to get only one
> path.
The file_id and course_session_id are a combination primary key for
the FileToSession table, so there is only one.
>
> and just return $resultset->getString(1);
I tried:
 public function getFilePath()
        {
                $sessionid = sfContext::getInstance()->getUser()-
>getAttribute('sessionid');

                $c = new Criteria();
                $c->clearSelectColumns();
                $c->addSelectColumn(FilePeer::FILE_PATH);
                $c->addJoin( FileToSessionPeer::FILE_ID,
FilePeer::ID);
                $c->add(FileToSessionPeer::FILE_ID, $this-
>getFileId());
                $c->addAnd(FileToSessionPeer::COURSE_SESSION_ID,
$sessionid);
                $c->setLimit(1);

                $resultset = FilePeer::doSelectRS($c);
                return $resultset->getString(1);
     }
But this throws error: "invalid resultset column: 1"
This is related to:
http://trac.symfony-project.com/browser/trunk/lib/vendor/creole/drivers/mysql/MySQLResultSet.php?rev=1723
public function getString($column)
107         {
108             $idx = (is_int($column) ? $column - 1 : $column);
109             if (!array_key_exists($idx, $this->fields)) { throw new
SQLException("Invalid resultset column: " . $column); }
110             if ($this->fields[$idx] === null) { return null; }
111             return (string) $this->fields[$idx];
112         }

I think because resultset is an array of keys and values and I'm not
returning it right???

I also tried:
...
                $c->addAnd(FileToSessionPeer::COURSE_SESSION_ID,
$sessionid);
                $c->setLimit(1);

                $resultset = FilePeer::doSelectOne($c);
                return $resultset->getString(1);
     }
But then I get "wrapped: invalid resultset column: 2"

> You have to test that the result is not null.
The file_path is a required field in the File table, so it's not null,
but I understand the wisdom of testing for null anyway.

I do appreciate your advice and help, Thomas. Thank you.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to