OroPlatform bundle that provide multi-channel/Omni-Channel Message generation with query builder: SMS, Email, Inbox, IVR, Twitter, Facebook, etc -- DEVELOPMENT REPO
Other
3
stars
4
forks
source link
Modifications made to the platform-communication-bundle #17
Modifications made to the platform-transport-bundle
file: Model/Message.php
Added:
the property $user
/**
* @var \Oro\Bundle\UserBundle\Entity\User
*/
protected $user; # region accessors
Having access to the user entity in the transport class, make it easier to do the personalization.
the property $Data
use Attribute\Data;
There are scenarios where the input data do not exist in the Oro or DS databases. For example, when a user creates an account in the MTL citizen system. His account is created in gluu and a json parameter is passed to the transport containing his email address, etc. needed to send him an account creation confirmation email, to activate his account.
Modifications made to the platform-communication-bundle
There are scenarios where there won't be a user entity, but only what's in the input parameters, so the property data will contain what has been passed.
The message entity has to contain a reference to the user entity if available and the data property contains the input parameters passed. The template property is needed to keep a record of what template was used when this message was created.
Stephen suggests having a template versioning system and used the template version ID here instead of the template content, like I did because of time constraint.
Modifications made to the platform-transport-bundle
file: Model/Message.php
Added:
the property $Data
use Attribute\Data;
Modifications made to the platform-communication-bundle
files: Channel/AbstractChannel.php Entity/Message.php Manager/CommunicationManager.php
git diff Channel/AbstractChannel.php $persona = $this->personaManager->getList(null, null, [ "-" 'user' => $message->getUser(), "-" 'type' => 'default' "+" 'user' => $message->getUser() ]);
$persona = array_shift($persona); "-" $to = $persona->getData($message->getChannel()->getDefaultTo()); "+" if (null !== $persona) { "+" $to = $persona->getData($message->getChannel()->getDefaultTo()); "+" } else { "+" $to = $message->getData("to"); "+" }
$messageModel = new MessageModel; $messageModel ->setTo($to) "+" ->setUser($message->getUser()) "+" ->setData($message->getData()) ->setTitle($message->getTitle()) "+" ->setTemplate($message->getTemplate()) ->setContent($message->getPresentation());
"-" $this->transport->send($messageModel); "+" $this->transport->send($messageModel, $this->transport->getProfile());
git diff Entity/Message.php
use Attribute\Title; use Attribute\Presentation; use Attribute\SentAt; "+" use Attribute\Data; use Ownership\BusinessUnitAwareTrait;
"+" /* "+" @var string "+" @ORM\Column(name="template", type="text", nullable=true) "+" @Assert\Length(max=65532, maxMessage="ds.entity.presentation.length.max") "+" */ "+" protected $template; # region accessors
git diff Manager/CommunicationManager.php
->setUser($user) ->setChannel($content->getChannel()) ->setTitle($content->getTitle()) "+" ->setTemplate($content->getTemplate()->getPresentation()) ->setPresentation($content->getPresentation());