if ($email === null ||
$groupId === null
) { $this->
View()->
assign([ 'success' => false,
'message' =>
$this->
translateMessage('error_msg/mail_and_group_missing', 'Email and groupId needed'
),
]);
return;
} $model =
new Address();
$model->
setGroupId($groupId);
$model->
setEmail($email);
$model->
setIsCustomer(false
);
$this->
get('models'
)->
persist($model);
$this->
get('models'
)->
flush();
$this->
View()->
assign(['success' => true, 'data' =>
$this->
get('models'
)->
toArray($model)]);
} /**
* Will return a handy list of custom newsletter groups and number of recipients
* Right now SQL is used, as we need to join different tables depending on address.customer
* todo@dn: Doctrinify
*/