I got 2 models:
class Mail
with relation:
'relAttachments' => array(self::MANY_MANY, 'File', 'rel_mail_file(rel_mail, rel_file)'),
Mail
has the AdvancedArBehavior extension attached so i can link Attachments to it with a 1-liner, which i do like this:
$mail->relAttachments = $attachments; // $attachments is an array of ids for `File` models
class Mailque
with relation:
'relMail' => array(self::BELONGS_TO, 'Mail', 'rel_mail'),
Once i saved and linked Mail and Mailque, i run this code after sending out the mail:
$mail = Mail::model()->findByPk($id);
$mailModel = $mail->relMail;
var_dump(count($mailModel->relAttachments)); // outputs 1
$mailModel->sent = time();
$mailModel->save();
//$mail->delete();
The call to save() yields the following error:
exception 'CException' with message 'Property "File.rel_file" is not defined.' in ...\framework\base\CComponent.php:131
Does anyone know what is going on here?