public function setMailingLists(array $datas) { foreach ($datas as $key => $value) { $mailingList = new MailingList(); $this->mailing_lists[] = $mailingList->fromArray($value); } return $this; }
public function addMailingLists(array $datas) { foreach ($datas as $key => $value) { if ($value instanceof MailingList) { $this->mailing_lists[$value->getId()] = $value; } else { $mailingList = new MailingList(); $mailingList->fromArray($value); $this->mailing_lists[$mailingList->getId()] = $mailingList; } } return $this; }