Commit f6df1f1d authored by mmn's avatar mmn

Documentation and more understandable code.

parent 286b54e5
...@@ -61,11 +61,16 @@ class ImageFile ...@@ -61,11 +61,16 @@ class ImageFile
{ {
$this->id = $id; $this->id = $id;
if (!empty($this->id)) { if (!empty($this->id)) {
$this->fileRecord = File::getKV('id', $this->id); $this->fileRecord = new File();
if (!$this->fileRecord instanceof File) { $this->fileRecord->id = $this->id;
throw new ServerException('Expected File object did not exist.'); if (!$this->find(true)) {
// If we have set an ID, we need that ID to exist!
throw new NoResultException($this->fileRecord);
} }
} }
// These do not have to be the same as fileRecord->filename for example,
// since we may have generated an image source file from something else!
$this->filepath = $filepath; $this->filepath = $filepath;
$this->filename = basename($filepath); $this->filename = basename($filepath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment