Merge pull request #5369 from christianbeeznest/fixes-migration7

Internal: Add NotificationEvent user table and relationship
pull/5370/head
christianbeeznest 1 year ago committed by GitHub
commit 6e384f881e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      src/CoreBundle/Controller/Admin/IndexBlocksController.php
  2. 30
      src/CoreBundle/Entity/NotificationEvent.php
  3. 54
      src/CoreBundle/Entity/NotificationEventRelUser.php
  4. 2
      src/CoreBundle/Migrations/Schema/V200/Version20230216122900.php
  5. 2
      src/CoreBundle/Settings/PlatformSettingsSchema.php

@ -475,7 +475,7 @@ class IndexBlocksController extends BaseController
];
}
if (api_get_configuration_value('notification_event')) {
if ('true' === api_get_setting('platform.notification_event')) {
$items[] = [
'class' => 'item-notification-list',
'url' => $this->generateUrl('legacy_main', ['name' => 'notification_event/list.php']),

@ -21,22 +21,22 @@ class NotificationEvent
protected string $title;
#[ORM\Column(name: 'content', type: 'text', nullable: true)]
protected string $content;
protected ?string $content = null;
#[ORM\Column(name: 'link', type: 'text', nullable: true)]
protected string $link;
protected ?string $link = null;
#[ORM\Column(name: 'persistent', type: 'integer', nullable: true)]
protected int $persistent;
protected ?int $persistent = null;
#[ORM\Column(name: 'day_diff', type: 'integer', nullable: true)]
protected int $dayDiff;
protected ?int $dayDiff = null;
#[ORM\Column(name: 'event_type', type: 'string', length: 255, nullable: false)]
protected string $eventType;
#[ORM\Column(name: 'event_id', type: 'integer', nullable: true)]
protected int $eventId;
protected ?int $eventId = null;
public function getId(): ?int
{
@ -62,48 +62,48 @@ class NotificationEvent
return $this;
}
public function getContent(): string
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getLink(): string
public function getLink(): ?string
{
return $this->link;
}
public function setLink(string $link): self
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
public function getPersistent(): int
public function getPersistent(): ?int
{
return $this->persistent;
}
public function setPersistent(int $persistent): self
public function setPersistent(?int $persistent): self
{
$this->persistent = $persistent;
return $this;
}
public function getDayDiff(): int
public function getDayDiff(): ?int
{
return $this->dayDiff;
}
public function setDayDiff(int $dayDiff): self
public function setDayDiff(?int $dayDiff): self
{
$this->dayDiff = $dayDiff;
@ -122,12 +122,12 @@ class NotificationEvent
return $this;
}
public function getEventId(): int
public function getEventId(): ?int
{
return $this->eventId;
}
public function setEventId(int $eventId): self
public function setEventId(?int $eventId): self
{
$this->eventId = $eventId;

@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: 'notification_event_rel_user')]
class NotificationEventRelUser
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(name: 'id', type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: NotificationEvent::class)]
#[ORM\JoinColumn(name: 'event_id', referencedColumnName: 'id', nullable: false)]
private NotificationEvent $event;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)]
private User $user;
public function getId(): ?int
{
return $this->id;
}
public function getEvent(): NotificationEvent
{
return $this->event;
}
public function setEvent(NotificationEvent $event): self
{
$this->event = $event;
return $this;
}
public function getUser(): User
{
return $this->user;
}
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
}

@ -169,6 +169,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
'disable_user_conditions_sender_id',
'portfolio_advanced_sharing',
'redirect_index_to_url_for_logged_users',
'notification_event',
],
'Profile' => [
'linkedin_organization_id',
@ -1009,6 +1010,7 @@ class Version20230216122900 extends AbstractMigrationChamilo
'linkedin_organization_id',
],
'Platform' => [
'notification_event',
'redirect_index_to_url_for_logged_users',
'portfolio_advanced_sharing',
'disable_user_conditions_sender_id',

@ -104,6 +104,7 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
'portfolio_advanced_sharing' => 'false',
'redirect_index_to_url_for_logged_users' => '',
'default_menu_entry_for_course_or_session' => 'my_courses',
'notification_event' => 'false',
]
)
->setTransformer(
@ -345,6 +346,7 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
],
]
)
->add('notification_event', YesNoType::class)
;
$this->updateFormFieldsFromSettingsInfo($builder);

Loading…
Cancel
Save