/** * Adds an existing channel to the folder. If the given channel is already * part of another folder, it will be automatically removed from the old folder. * * @param MessageChannel $channel The channel which should be added to the folder. * * @return AbstractPostboxFolder Returns itself (fluent-interface) */ public function addChannel(MessageChannel $channel) { // first remove the channel /* @var $oldFolder AbstractPostboxFolder */ $oldFolder = $channel->loadRelatedObject('PostboxFolder2MessageChannel'); if ($oldFolder !== null) { $oldFolder->removeChannel($channel); } $this->createAssociation('PostboxFolder2MessageChannel', $channel); return $this; }