Hey Sean
Will change to validating the return of the object to simplify things much better way of doing it.
The object is returned, if I run the query outside of sending the email I can get $MFFileName displayed whether I use
$filename = DataObject::get_by_id("MonkeysFist", $_GET['mfid']); or $filename = DataObject::get_by_id("MonkeysFist", 4); and the row is definitely in the table
So I take that to mean that the problem is not so much with $_GET['mfid'] but what is actually returned, I am wondering about the type.
I have simplified things for testing and am using
$filename = DataObject::get_by_id("MonkeysFist", $_GET['mfid']);
$filepath = "assets/Uploads/mf_attachments/ItsMyLifeCoaching.pdf";
$emailToSubmiter->attachFile($filepath, $filename->MFFileName);
as I think there might be a second issue with $filepath which I am running on a separate thread on http://www.silverstripe.org/general-questions/show/268650#post268650.
$filename = DataObject::get_by_id("MonkeysFist", 4);
$filepath = "assets/Uploads/mf_attachments/ItsMyLifeCoaching.pdf";
$emailToSubmiter->attachFile($filepath, $filename->MFFileName);
returns an email with an attachment of the name defined by $filename->MFFileName
$filename = DataObject::get_by_id("MonkeysFist", $_GET['mfid']);
$filepath = "assets/Uploads/mf_attachments/ItsMyLifeCoaching.pdf";
$emailToSubmiter->attachFile($filepath, $filename->MFFileName);
return and email with an attachment but its name is given as "noname" which I understand as $filename->MFFileName has no value.
I have not been able to get Debug::show($file); to work as I cannot see directly what is coming back. Again I have tried taken it outside of the email function and just done
function Filetest() {
$file = DataObject::get_by_id("MonkeysFist", (int) $_GET['mfid']);
Debug::show($file);
return $file;
}
but I don't get anything displayed.
Any thoughts? Thanks
MM