diff --git a/Command/SendSmsCampaignsCommand.php b/Command/SendSmsCampaignsCommand.php index f587681..6f86cad 100644 --- a/Command/SendSmsCampaignsCommand.php +++ b/Command/SendSmsCampaignsCommand.php @@ -22,11 +22,9 @@ /** * Command to send scheduled SMS campaigns */ +#[\Symfony\Component\Console\Attribute\AsCommand('oro:cron:send-sms-campaigns', 'Send SMS campaigns')] class SendSmsCampaignsCommand extends Command implements CronCommandScheduleDefinitionInterface { - /** @var string */ - protected static $defaultName = 'oro:cron:send-sms-campaigns'; - /** @var ManagerRegistry */ private $registry; @@ -82,12 +80,12 @@ protected function getSmsCampaignRepository() /** * {@inheritdoc} */ - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { if (!$this->featureChecker->isFeatureEnabled('campaign')) { $output->writeln('The campaign feature is disabled. The command will not run.'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } $smsCampaigns = $this->getSmsCampaignRepository()->findSmsCampaignsToSend(); @@ -95,7 +93,7 @@ public function execute(InputInterface $input, OutputInterface $output) if (!$smsCampaigns) { $output->writeln('No SMS campaigns to send'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } $output->writeln( @@ -105,7 +103,7 @@ public function execute(InputInterface $input, OutputInterface $output) $this->send($output, $smsCampaigns); $output->writeln(sprintf('Finished SMS campaigns sending')); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } /** @@ -129,7 +127,5 @@ protected function send($output, array $smsCampaigns) */ protected function configure() { - $this - ->setDescription('Send SMS campaigns'); } } diff --git a/Controller/SmsCampaignController.php b/Controller/SmsCampaignController.php index ec7d501..20e1f7e 100644 --- a/Controller/SmsCampaignController.php +++ b/Controller/SmsCampaignController.php @@ -14,8 +14,8 @@ use Diglin\Bundle\SmsCampaignBundle\Form\Type\SmsCampaignType; use Diglin\Bundle\SmsCampaignBundle\Model\SmsCampaignSenderBuilder; use Doctrine\Persistence\ManagerRegistry; -use Oro\Bundle\SecurityBundle\Annotation\Acl; -use Oro\Bundle\SecurityBundle\Annotation\AclAncestor; +use Oro\Bundle\SecurityBundle\Attribute\Acl; +use Oro\Bundle\SecurityBundle\Attribute\AclAncestor; use Oro\Bundle\UIBundle\Route\Router; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -24,15 +24,14 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * Serve CRUD of SmsCampaign entity. - * - * @Route("/campaign/sms") */ +#[\Symfony\Component\Routing\Attribute\Route(path: '/campaign/sms')] class SmsCampaignController extends AbstractController { private FormFactoryInterface $formFactory; @@ -70,7 +69,7 @@ public function setValidator(ValidatorInterface $validator): void /** * {@inheritdoc} */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return array_merge( parent::getSubscribedServices(), @@ -86,11 +85,9 @@ public static function getSubscribedServices() ); } - /** - * @Route("/", name="diglin_sms_campaign_index") - * @AclAncestor("diglin_sms_campaign_view") - * @Template - */ + #[\Symfony\Component\Routing\Attribute\Route(path: '/', name: 'diglin_sms_campaign_index')] + #[AclAncestor('diglin_sms_campaign_view')] + #[Template] public function indexAction() { return [ @@ -100,16 +97,10 @@ public function indexAction() /** * Create SMS campaign - * - * @Route("/create", name="diglin_sms_campaign_create") - * @Template("@SmsCampaign/SmsCampaign/update.html.twig") - * @Acl( - * id="diglin_sms_campaign_create", - * type="entity", - * permission="CREATE", - * class="SmsCampaignBundle:SmsCampaign" - * ) */ + #[\Symfony\Component\Routing\Attribute\Route(path: '/create', name: 'diglin_sms_campaign_create')] + #[Template('@SmsCampaign/SmsCampaign/update.html.twig')] + #[Acl(id: 'diglin_sms_campaign_create', type: 'entity', permission: 'CREATE', class: 'SmsCampaignBundle:SmsCampaign')] public function createAction() { return $this->update(new SmsCampaign()); @@ -154,19 +145,13 @@ protected function update(SmsCampaign $entity) /** * Edit SMS campaign * - * @Route("/update/{id}", name="diglin_sms_campaign_update", requirements={"id"="\d+"}, defaults={"id"=0}) - * @Template - * @Acl( - * id="diglin_sms_campaign_update", - * type="entity", - * permission="EDIT", - * class="SmsCampaignBundle:SmsCampaign" - * ) * * @param SmsCampaign $entity - * * @return array */ + #[\Symfony\Component\Routing\Attribute\Route(path: '/update/{id}', name: 'diglin_sms_campaign_update', requirements: ['id' => '\d+'], defaults: ['id' => 0])] + #[Template] + #[Acl(id: 'diglin_sms_campaign_update', type: 'entity', permission: 'EDIT', class: 'SmsCampaignBundle:SmsCampaign')] public function updateAction(SmsCampaign $entity) { return $this->update($entity); @@ -175,19 +160,13 @@ public function updateAction(SmsCampaign $entity) /** * View SMS campaign * - * @Route("/view/{id}", name="diglin_sms_campaign_view", requirements={"id"="\d+"}) - * @Acl( - * id="diglin_sms_campaign_view", - * type="entity", - * permission="VIEW", - * class="SmsCampaignBundle:SmsCampaign" - * ) - * @Template * * @param SmsCampaign $entity - * * @return array */ + #[\Symfony\Component\Routing\Attribute\Route(path: '/view/{id}', name: 'diglin_sms_campaign_view', requirements: ['id' => '\d+'])] + #[Acl(id: 'diglin_sms_campaign_view', type: 'entity', permission: 'VIEW', class: 'SmsCampaignBundle:SmsCampaign')] + #[Template] public function viewAction(SmsCampaign $entity) { $stats = $this->managerRegistry @@ -226,20 +205,12 @@ protected function isManualSendAllowed(SmsCampaign $entity) } /** - * @Route("/send/{id}", name="diglin_sms_campaign_send", requirements={"id"="\d+"}) - * @Acl( - * id="diglin_sms_campaign_send", - * type="action", - * label="oro.campaign.acl.send_emails.label", - * description="oro.campaign.acl.send_emails.description", - * group_name="", - * category="marketing" - * ) * * @param SmsCampaign $entity - * * @return RedirectResponse */ + #[\Symfony\Component\Routing\Attribute\Route(path: '/send/{id}', name: 'diglin_sms_campaign_send', requirements: ['id' => '\d+'])] + #[Acl(id: 'diglin_sms_campaign_send', type: 'action', label: 'oro.campaign.acl.send_emails.label', description: 'oro.campaign.acl.send_emails.description', group_name: '', category: 'marketing')] public function sendAction(SmsCampaign $entity) { if ($this->isManualSendAllowed($entity)) { diff --git a/Entity/SmsCampaign.php b/Entity/SmsCampaign.php index 6b829ec..2d307fb 100644 --- a/Entity/SmsCampaign.php +++ b/Entity/SmsCampaign.php @@ -13,49 +13,22 @@ use Doctrine\ORM\Mapping as ORM; use Oro\Bundle\CampaignBundle\Entity\Campaign; use Oro\Bundle\CampaignBundle\Entity\TransportSettings; -use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config; -use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField; +use Oro\Bundle\EntityConfigBundle\Metadata\Attribute\Config; +use Oro\Bundle\EntityConfigBundle\Metadata\Attribute\ConfigField; use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityInterface; use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityTrait; use Oro\Bundle\MarketingListBundle\Entity\MarketingList; use Oro\Bundle\OrganizationBundle\Entity\Organization; use Oro\Bundle\UserBundle\Entity\User; -/** - * @ORM\Entity(repositoryClass="Diglin\Bundle\SmsCampaignBundle\Entity\Repository\SmsCampaignRepository") - * @ORM\Table( - * name="diglin_campaign_sms", - * indexes={@ORM\Index(name="cmpgn_sms_owner_idx", columns={"owner_id"})} - * ) - * @ORM\HasLifecycleCallbacks() - * @Config( - * defaultValues={ - * "entity"={ - * "icon"="fa-envelope" - * }, - * "ownership"={ - * "owner_type"="USER", - * "owner_field_name"="owner", - * "owner_column_name"="owner_id", - * "organization_field_name"="organization", - * "organization_column_name"="organization_id" - * }, - * "security"={ - * "type"="ACL", - * "group_name"="", - * "category"="marketing" - * }, - * "grid"={ - * "default"="oro-sms-campaign-grid" - * }, - * "tag"={ - * "enabled"=true - * } - * } - * ) - */ -class SmsCampaign extends ExtendSmsCampaign implements ExtendEntityInterface +#[ORM\Entity(repositoryClass: \Diglin\Bundle\SmsCampaignBundle\Entity\Repository\SmsCampaignRepository::class)] +#[ORM\HasLifecycleCallbacks] +#[Config(defaultValues: ['entity' => ['icon' => 'fa-envelope'], 'ownership' => ['owner_type' => 'USER', 'owner_field_name' => 'owner', 'owner_column_name' => 'owner_id', 'organization_field_name' => 'organization', 'organization_column_name' => 'organization_id'], 'security' => ['type' => 'ACL', 'group_name' => '', 'category' => 'marketing'], 'grid' => ['default' => 'oro-sms-campaign-grid'], 'tag' => ['enabled' => true]])] +#[ORM\Table(name: 'diglin_campaign_sms')] +#[ORM\Index(name: 'cmpgn_sms_owner_idx', columns: ['owner_id'])] +class SmsCampaign implements ExtendEntityInterface { + use \Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityTrait; use ExtendEntityTrait; const SCHEDULE_MANUAL = 'manual'; @@ -63,139 +36,107 @@ class SmsCampaign extends ExtendSmsCampaign implements ExtendEntityInterface /** * @var int - * - * @ORM\Id - * @ORM\Column(type="integer", name="id") - * @ORM\GeneratedValue(strategy="AUTO") */ + #[ORM\Id] + #[ORM\Column(type: 'integer', name: 'id')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected $id; /** * @var string - * - * @ORM\Column(name="name", type="string", length=255) */ + #[ORM\Column(name: 'name', type: 'string', length: 255)] protected $name; /** * @var string - * - * @ORM\Column(name="text", type="text", nullable=true) */ + #[ORM\Column(name: 'text', type: 'text', nullable: true)] protected $text; /** * @var boolean - * - * @ORM\Column(name="is_sent", type="boolean") */ + #[ORM\Column(name: 'is_sent', type: 'boolean')] protected $sent = false; /** * @var \DateTime - * - * @ORM\Column(name="sent_at", type="datetime", nullable=true) */ + #[ORM\Column(name: 'sent_at', type: 'datetime', nullable: true)] protected $sentAt; /** * @var string - * - * @ORM\Column(name="schedule", type="string", length=255) */ + #[ORM\Column(name: 'schedule', type: 'string', length: 255)] protected $schedule; /** * @var ?\DateTime - * - * @ORM\Column(name="scheduled_for", type="datetime", nullable=true) */ + #[ORM\Column(name: 'scheduled_for', type: 'datetime', nullable: true)] protected $scheduledFor; /** * @var Campaign - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\CampaignBundle\Entity\Campaign") - * @ORM\JoinColumn(name="campaign_id", referencedColumnName="id", onDelete="SET NULL", nullable=true) */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\CampaignBundle\Entity\Campaign::class)] + #[ORM\JoinColumn(name: 'campaign_id', referencedColumnName: 'id', onDelete: 'SET NULL', nullable: true)] protected $campaign; /** * @var MarketingList - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\MarketingListBundle\Entity\MarketingList") - * @ORM\JoinColumn(name="marketing_list_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\MarketingListBundle\Entity\MarketingList::class)] + #[ORM\JoinColumn(name: 'marketing_list_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $marketingList; /** * @var User - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\UserBundle\Entity\User") - * @ORM\JoinColumn(name="owner_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\UserBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'owner_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $owner; /** * @var string - * - * @ORM\Column(name="transport", type="string", length=255, nullable=false) */ + #[ORM\Column(name: 'transport', type: 'string', length: 255, nullable: false)] protected $transport; /** * @var TransportSettings - * - * @ORM\OneToOne( - * targetEntity="Oro\Bundle\CampaignBundle\Entity\TransportSettings", - * cascade={"all"}, - * orphanRemoval=true - * ) - * @ORM\JoinColumn(name="transport_settings_id", referencedColumnName="id", onDelete="SET NULL", nullable=true) */ + #[ORM\OneToOne(targetEntity: \Oro\Bundle\CampaignBundle\Entity\TransportSettings::class, cascade: ['all'], orphanRemoval: true)] + #[ORM\JoinColumn(name: 'transport_settings_id', referencedColumnName: 'id', onDelete: 'SET NULL', nullable: true)] protected $transportSettings; /** * @var Organization - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization") - * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\OrganizationBundle\Entity\Organization::class)] + #[ORM\JoinColumn(name: 'organization_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $organization; /** * @var \DateTime - * - * @ORM\Column(name="created_at", type="datetime") - * @ConfigField( - * defaultValues={ - * "entity"={ - * "label"="oro.ui.created_at" - * } - * } - * ) */ + #[ORM\Column(name: 'created_at', type: 'datetime')] + #[ConfigField(defaultValues: ['entity' => ['label' => 'oro.ui.created_at']])] protected $createdAt; /** * @var \DateTime - * - * @ORM\Column(name="updated_at", type="datetime") - * @ConfigField( - * defaultValues={ - * "entity"={ - * "label"="oro.ui.updated_at" - * } - * } - * ) */ + #[ORM\Column(name: 'updated_at', type: 'datetime')] + #[ConfigField(defaultValues: ['entity' => ['label' => 'oro.ui.updated_at']])] protected $updatedAt; /** * Pre persist event handler - * - * @ORM\PrePersist */ + #[ORM\PrePersist] public function prePersist() { $this->createdAt = new \DateTime('now', new \DateTimeZone('UTC')); @@ -204,9 +145,8 @@ public function prePersist() /** * Pre update event handler - * - * @ORM\PreUpdate */ + #[ORM\PreUpdate] public function preUpdate() { $this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC')); diff --git a/Entity/SmsCampaignStatistics.php b/Entity/SmsCampaignStatistics.php index c4fac39..3e1fe09 100644 --- a/Entity/SmsCampaignStatistics.php +++ b/Entity/SmsCampaignStatistics.php @@ -11,7 +11,7 @@ use Diglin\Bundle\SmsCampaignBundle\Model\ExtendSmsCampaignStatistics; use Doctrine\ORM\Mapping as ORM; -use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config; +use Oro\Bundle\EntityConfigBundle\Metadata\Attribute\Config; use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityInterface; use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityTrait; use Oro\Bundle\MarketingListBundle\Entity\MarketingListItem; @@ -20,90 +20,63 @@ /** * SMS Campaign Statistics. - * - * @ORM\Entity(repositoryClass="Diglin\Bundle\SmsCampaignBundle\Entity\Repository\SmsCampaignStatisticsRepository") - * @ORM\Table(name="diglin_campaign_sms_stats", uniqueConstraints={ - * @ORM\UniqueConstraint(columns={"sms_campaign_id", "marketing_list_item_id"}, - * name="diglin_sm_campaign_litem_unq") - * }) - * @Config( - * defaultValues={ - * "entity"={ - * "icon"="fa-bar-chart-o" - * }, - * "ownership"={ - * "owner_type"="USER", - * "owner_field_name"="owner", - * "owner_column_name"="owner_id", - * "organization_field_name"="organization", - * "organization_column_name"="organization_id" - * }, - * "security"={ - * "type"="ACL", - * "group_name"="", - * "category"="marketing" - * } - * } - * ) - * @ORM\HasLifecycleCallbacks */ -class SmsCampaignStatistics extends ExtendSmsCampaignStatistics implements ExtendEntityInterface +#[ORM\Entity(repositoryClass: \Diglin\Bundle\SmsCampaignBundle\Entity\Repository\SmsCampaignStatisticsRepository::class)] +#[Config(defaultValues: ['entity' => ['icon' => 'fa-bar-chart-o'], 'ownership' => ['owner_type' => 'USER', 'owner_field_name' => 'owner', 'owner_column_name' => 'owner_id', 'organization_field_name' => 'organization', 'organization_column_name' => 'organization_id'], 'security' => ['type' => 'ACL', 'group_name' => '', 'category' => 'marketing']])] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'diglin_campaign_sms_stats')] +#[ORM\UniqueConstraint(columns: ['sms_campaign_id', 'marketing_list_item_id'], name: 'diglin_sm_campaign_litem_unq')] +class SmsCampaignStatistics implements ExtendEntityInterface { + use \Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityTrait; use ExtendEntityTrait; /** * @var int - * - * @ORM\Id - * @ORM\Column(type="integer", name="id") - * @ORM\GeneratedValue(strategy="AUTO") */ + #[ORM\Id] + #[ORM\Column(type: 'integer', name: 'id')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected $id; /** * @var MarketingListItem - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\MarketingListBundle\Entity\MarketingListItem") - * @ORM\JoinColumn(name="marketing_list_item_id", referencedColumnName="id", onDelete="CASCADE", nullable=false) */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\MarketingListBundle\Entity\MarketingListItem::class)] + #[ORM\JoinColumn(name: 'marketing_list_item_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)] protected $marketingListItem; /** * @var SmsCampaign - * - * @ORM\ManyToOne(targetEntity="Diglin\Bundle\SmsCampaignBundle\Entity\SmsCampaign") - * @ORM\JoinColumn(name="sms_campaign_id", referencedColumnName="id", onDelete="CASCADE", nullable=false) */ + #[ORM\ManyToOne(targetEntity: \Diglin\Bundle\SmsCampaignBundle\Entity\SmsCampaign::class)] + #[ORM\JoinColumn(name: 'sms_campaign_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)] protected $smsCampaign; /** * @var int - * - * @ORM\Column(name="bounce_count", type="integer", nullable=true) */ + #[ORM\Column(name: 'bounce_count', type: 'integer', nullable: true)] protected $bounceCount; /** * @var \DateTime - * - * @ORM\Column(name="created_at", type="datetime") */ + #[ORM\Column(name: 'created_at', type: 'datetime')] protected $createdAt; /** * @var User - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\UserBundle\Entity\User") - * @ORM\JoinColumn(name="owner_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\UserBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'owner_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $owner; /** * @var Organization - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization") - * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\OrganizationBundle\Entity\Organization::class)] + #[ORM\JoinColumn(name: 'organization_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $organization; /** @@ -162,9 +135,8 @@ public function setCreatedAt(\DateTime $createdAt) /** * Pre persist event handler - * - * @ORM\PrePersist */ + #[ORM\PrePersist] public function prePersist() { $this->createdAt = new \DateTime('now', new \DateTimeZone('UTC')); diff --git a/Entity/SmsTransportSettings.php b/Entity/SmsTransportSettings.php index 1862c67..82546e8 100644 --- a/Entity/SmsTransportSettings.php +++ b/Entity/SmsTransportSettings.php @@ -14,17 +14,14 @@ use Oro\Bundle\IntegrationBundle\Entity\Channel; use Symfony\Component\HttpFoundation\ParameterBag; -/** - * @ORM\Entity - */ +#[ORM\Entity] class SmsTransportSettings extends TransportSettings { /** * @var Channel - * - * @ORM\ManyToOne(targetEntity="Oro\Bundle\IntegrationBundle\Entity\Channel") - * @ORM\JoinColumn(name="sms_channel_id", referencedColumnName="id", onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: \Oro\Bundle\IntegrationBundle\Entity\Channel::class)] + #[ORM\JoinColumn(name: 'sms_channel_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected $channel; /** diff --git a/Form/EventListener/TransportSettingsListener.php b/Form/EventListener/TransportSettingsListener.php index 0c9fdfd..2938aac 100644 --- a/Form/EventListener/TransportSettingsListener.php +++ b/Form/EventListener/TransportSettingsListener.php @@ -43,7 +43,7 @@ public function __construct(SmsTransportProvider $smsTransportProvider, Doctrine /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ FormEvents::PRE_SET_DATA => 'preSet', diff --git a/Form/Type/IntegrationSelectType.php b/Form/Type/IntegrationSelectType.php index cf088a5..0a9216c 100644 --- a/Form/Type/IntegrationSelectType.php +++ b/Form/Type/IntegrationSelectType.php @@ -80,7 +80,7 @@ protected function getSmsIntegrations(): array /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return EntityType::class; } @@ -96,7 +96,7 @@ public function getName() /** * {@inheritdoc} */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return self::NAME; } diff --git a/Form/Type/SmsCampaignType.php b/Form/Type/SmsCampaignType.php index 9fbc89a..bf07c84 100644 --- a/Form/Type/SmsCampaignType.php +++ b/Form/Type/SmsCampaignType.php @@ -168,7 +168,7 @@ public function getName(): string /** * {@inheritdoc} */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'diglin_sms_campaign'; } diff --git a/Form/Type/SmsTransportSelectType.php b/Form/Type/SmsTransportSelectType.php index 36889e2..2cc5062 100644 --- a/Form/Type/SmsTransportSelectType.php +++ b/Form/Type/SmsTransportSelectType.php @@ -44,7 +44,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return ChoiceType::class; } @@ -60,7 +60,7 @@ public function getName() /** * {@inheritdoc} */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'diglin_sms_campaign_sms_transport_select'; } diff --git a/Form/Type/SmsTransportSettingsType.php b/Form/Type/SmsTransportSettingsType.php index 321dae0..8e2dc8a 100644 --- a/Form/Type/SmsTransportSettingsType.php +++ b/Form/Type/SmsTransportSettingsType.php @@ -58,7 +58,7 @@ public function getName() /** * {@inheritdoc} */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return self::NAME; } diff --git a/Model/ExtendSmsCampaign.php b/Model/ExtendSmsCampaign.php deleted file mode 100644 index 9fc770a..0000000 --- a/Model/ExtendSmsCampaign.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @category SmsCampaignBundle - * @copyright 2020 - Diglin (https://www.diglin.com) - */ - -namespace Diglin\Bundle\SmsCampaignBundle\Model; - -class ExtendSmsCampaign -{ - /** - * Constructor - * - * The real implementation of this method is auto generated. - * - * IMPORTANT: If the derived class has own constructor it must call parent constructor. - */ - public function __construct() - { - } -} diff --git a/Model/ExtendSmsCampaignStatistics.php b/Model/ExtendSmsCampaignStatistics.php deleted file mode 100644 index a20fee4..0000000 --- a/Model/ExtendSmsCampaignStatistics.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @category SmsCampaignBundle - * @copyright 2020 - Diglin (https://www.diglin.com) - */ - -namespace Diglin\Bundle\SmsCampaignBundle\Model; - -class ExtendSmsCampaignStatistics -{ - /** - * Constructor - * - * The real implementation of this method is auto generated. - * - * IMPORTANT: If the derived class has own constructor it must call parent constructor. - */ - public function __construct() - { - } -} diff --git a/Transport/SmsTransport.php b/Transport/SmsTransport.php index 236fd97..71124ce 100644 --- a/Transport/SmsTransport.php +++ b/Transport/SmsTransport.php @@ -64,7 +64,7 @@ public function send(SmsCampaign $campaign, $entity, array $to) $transport = $this->typeRegistry->getTransportTypeBySettingEntity($transportSettings, $channel->getType()); $transport->init($transportSettings); - if ($transport instanceof SendSmsInterface || method_exists($transport, 'sendSms')) { + if ($transport instanceof SendSmsInterface || \Oro\Bundle\EntityExtendBundle\EntityPropertyInfo::methodExists($transport, 'sendSms')) { foreach ($to as $recipientNumber) { $transport->sendSms($recipientNumber, $campaign->getText()); } diff --git a/composer.json b/composer.json index 0b5e989..113e589 100644 --- a/composer.json +++ b/composer.json @@ -2,8 +2,8 @@ "name": "diglin/orocrm-sms-campaign", "description": "Support to send SMS Campaign from OroCRM", "require": { - "php": "^7.3|~8.0.0|~8.1.0|~8.2.0", - "oro/marketing": "~5.1.0" + "php": "~8.3.0", + "oro/marketing": "6.0.*" }, "license": "OSL-3.0", "authors": [