diff --git a/src/CoreBundle/Entity/AbstractResource.php b/src/CoreBundle/Entity/AbstractResource.php index 3c39caa34b..7ac05d89bf 100644 --- a/src/CoreBundle/Entity/AbstractResource.php +++ b/src/CoreBundle/Entity/AbstractResource.php @@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Entity; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiSubresource; +use Chamilo\CoreBundle\Entity\Listener\ResourceListener; use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter; use Chamilo\CoreBundle\Traits\UserCreatorTrait; use Chamilo\CourseBundle\Entity\CGroup; @@ -17,40 +18,37 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\MappedSuperclass - * @ORM\HasLifecycleCallbacks - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\ResourceListener"}) - */ +#[ORM\MappedSuperclass] +#[ORM\HasLifecycleCallbacks] +#[ORM\EntityListeners([ResourceListener::class])] abstract class AbstractResource { use UserCreatorTrait; /** - * @ApiProperty(iri="http://schema.org/contentUrl") - * @Groups({"resource_file:read", "resource_node:read", "document:read", "media_object_read", "message:read"}) + * @ApiProperty(iri="https://schema.org/contentUrl") */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'media_object_read', 'message:read'])] public ?string $contentUrl = null; /** * Download URL of the Resource File Property set by ResourceNormalizer.php. * - * @ApiProperty(iri="http://schema.org/contentUrl") - * @Groups({"resource_file:read", "resource_node:read", "document:read", "media_object_read", "message:read"}) + * @ApiProperty(iri="https://schema.org/contentUrl") */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'media_object_read', 'message:read'])] public ?string $downloadUrl = null; /** * Content from ResourceFile - Property set by ResourceNormalizer.php. - * - * @Groups({"resource_file:read", "resource_node:read", "document:read", "document:write", "media_object_read"}) */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'document:write', 'media_object_read'])] public ?string $contentFile = null; /** * Resource illustration URL - Property set by ResourceNormalizer.php. * - * @ApiProperty(iri="http://schema.org/contentUrl") + * @ApiProperty(iri="https://schema.org/contentUrl") */ #[Groups([ 'resource_node:read', @@ -65,14 +63,6 @@ abstract class AbstractResource ])] public ?string $illustrationUrl = null; - /** - * @ORM\OneToOne( - * targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) - * @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\Valid] #[ApiSubresource] #[Groups([ @@ -86,6 +76,8 @@ abstract class AbstractResource 'message:read', 'c_tool_intro:read', ])] + #[ORM\OneToOne(targetEntity: ResourceNode::class, cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\JoinColumn(name: 'resource_node_id', referencedColumnName: 'id', onDelete: 'CASCADE')] public ?ResourceNode $resourceNode = null; /** @@ -95,14 +87,14 @@ abstract class AbstractResource public ?int $parentResourceNode = 0; /** - * @ApiProperty(iri="http://schema.org/image") + * @ApiProperty(iri="https://schema.org/image") */ public ?UploadedFile $uploadFile = null; /** * @var AbstractResource|ResourceInterface */ - public $parentResource; + public AbstractResource|ResourceInterface $parentResource; #[Groups(['resource_node:read', 'document:read'])] public ?array $resourceLinkListFromEntity = null; @@ -115,10 +107,47 @@ abstract class AbstractResource public array $resourceLinkList = []; /** - * @var array<\Chamilo\CoreBundle\Entity\ResourceLink> + * @var array */ public array $resourceLinkEntityList = []; + /** + * This function separates the users from the groups users have a value + * USER:XXX (with XXX the groups id have a value + * GROUP:YYY (with YYY the group id). + * + * @param array $to Array of strings that define the type and id of each destination + * + * @return array Array of groups and users (each an array of IDs) + */ + public static function separateUsersGroups(array $to): array + { + $sendTo = ['groups' => [], 'users' => []]; + + foreach ($to as $toItem) { + if (empty($toItem)) { + continue; + } + + $parts = explode(':', $toItem); + $type = $parts[0] ?? ''; + $id = $parts[1] ?? ''; + + switch ($type) { + case 'GROUP': + $sendTo['groups'][] = (int) $id; + + break; + case 'USER': + $sendTo['users'][] = (int) $id; + + break; + } + } + + return $sendTo; + } + abstract public function getResourceName(): string; abstract public function setResourceName(string $name); @@ -129,17 +158,14 @@ abstract class AbstractResource } /** - * $this->resourceLinkEntityList will be loaded in the ResourceListener in the setLinks() function. + * @throws Exception */ - public function addLink(ResourceLink $link): static - { - $this->resourceLinkEntityList[] = $link; - - return $this; - } - - public function addCourseLink(Course $course, Session $session = null, CGroup $group = null, int $visibility = ResourceLink::VISIBILITY_PUBLISHED) - { + public function addCourseLink( + Course $course, + Session $session = null, + CGroup $group = null, + int $visibility = ResourceLink::VISIBILITY_PUBLISHED + ): self { if (null === $this->getParent()) { throw new Exception('$resource->addCourseLink requires to set the parent first.'); } @@ -148,8 +174,7 @@ abstract class AbstractResource ->setVisibility($visibility) ->setCourse($course) ->setSession($session) - ->setGroup($group) - ; + ->setGroup($group); $rights = []; switch ($visibility) { @@ -158,8 +183,7 @@ abstract class AbstractResource $editorMask = ResourceNodeVoter::getEditorMask(); $resourceRight = (new ResourceRight()) ->setMask($editorMask) - ->setRole(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER) - ; + ->setRole(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER); $rights[] = $resourceRight; break; @@ -174,11 +198,9 @@ abstract class AbstractResource if ($this->hasResourceNode()) { $resourceNode = $this->getResourceNode(); $exists = $resourceNode->getResourceLinks()->exists( - function ($key, $element) use ($course, $session, $group) { - return $course === $element->getCourse() && - $session === $element->getSession() && - $group === $element->getGroup(); - } + fn ($key, $element) => $course === $element->getCourse() && + $session === $element->getSession() && + $group === $element->getGroup() ); if ($exists) { @@ -192,45 +214,68 @@ abstract class AbstractResource return $this; } - public function addGroupLink(Course $course, CGroup $group, Session $session = null) + public function getParent(): ResourceInterface|AbstractResource { - $resourceLink = (new ResourceLink()) - ->setCourse($course) - ->setSession($session) - ->setGroup($group) - ->setVisibility(ResourceLink::VISIBILITY_PUBLISHED) - ; + return $this->parentResource; + } - if ($this->hasResourceNode()) { - $resourceNode = $this->getResourceNode(); - $exists = $resourceNode->getResourceLinks()->exists( - function ($key, $element) use ($group) { - if ($element->getGroup()) { - return $group->getIid() === $element->getGroup()->getIid(); - } - } - ); + public function hasResourceNode(): bool + { + return $this->resourceNode instanceof ResourceNode; + } - if ($exists) { - return $this; + public function getResourceNode(): ?ResourceNode + { + return $this->resourceNode; + } + + public function setResourceNode(ResourceNode $resourceNode): self + { + $this->resourceNode = $resourceNode; + + return $this; + } + + /** + * $this->resourceLinkEntityList will be loaded in the ResourceListener in the setLinks() function. + */ + public function addLink(ResourceLink $link): static + { + $this->resourceLinkEntityList[] = $link; + + return $this; + } + + public function setParent(ResourceInterface $parent): static + { + $this->parentResource = $parent; + + return $this; + } + + public function addResourceToUserList( + array $userList, + Course $course = null, + Session $session = null, + CGroup $group = null + ): static { + if (!empty($userList)) { + foreach ($userList as $user) { + $this->addUserLink($user, $course, $session, $group); } - $resourceNode->addResourceLink($resourceLink); - } else { - $this->addLink($resourceLink); } return $this; } - public function addUserLink(User $user, Course $course = null, Session $session = null, CGroup $group = null) + public function addUserLink(User $user, Course $course = null, Session $session = null, CGroup $group = null): static { $resourceLink = (new ResourceLink()) ->setVisibility(ResourceLink::VISIBILITY_PUBLISHED) ->setUser($user) ->setCourse($course) ->setSession($session) - ->setGroup($group) - ; + ->setGroup($group); if ($this->hasResourceNode()) { $resourceNode = $this->getResourceNode(); @@ -239,6 +284,8 @@ abstract class AbstractResource if ($element->hasUser()) { return $user->getId() === $element->getUser()->getId(); } + + return false; } ); @@ -254,61 +301,60 @@ abstract class AbstractResource return $this; } - public function setParent(ResourceInterface $parent) - { - $this->parentResource = $parent; - - return $this; - } - - public function getParent() - { - return $this->parentResource; - } - - /** - * @param array $userList User id list - */ - public function addResourceToUserList( - array $userList, + public function addResourceToGroupList( + array $groupList, Course $course = null, Session $session = null, - CGroup $group = null - ) { - if (!empty($userList)) { - foreach ($userList as $user) { - $this->addUserLink($user, $course, $session, $group); - } + ): static { + foreach ($groupList as $group) { + $this->addGroupLink($course, $group, $session); } return $this; } - public function addResourceToGroupList( - array $groupList, - Course $course = null, - Session $session = null, - ) { - foreach ($groupList as $group) { - $this->addGroupLink($course, $group, $session); + public function addGroupLink(Course $course, CGroup $group, Session $session = null): static + { + $resourceLink = (new ResourceLink()) + ->setCourse($course) + ->setSession($session) + ->setGroup($group) + ->setVisibility(ResourceLink::VISIBILITY_PUBLISHED); + + if ($this->hasResourceNode()) { + $resourceNode = $this->getResourceNode(); + $exists = $resourceNode->getResourceLinks()->exists( + function ($key, $element) use ($group) { + if ($element->getGroup()) { + return $group->getIid() === $element->getGroup()->getIid(); + } + } + ); + + if ($exists) { + return $this; + } + $resourceNode->addResourceLink($resourceLink); + } else { + $this->addLink($resourceLink); } return $this; } - public function getResourceLinkArray() + public function getResourceLinkArray(): array { return $this->resourceLinkList; } - public function setResourceLinkArray(array $links) + public function setResourceLinkArray(array $links): static { $this->resourceLinkList = $links; return $this; } - public function getResourceLinkListFromEntity() + public function getResourceLinkListFromEntity(): ?array { return $this->resourceLinkListFromEntity; } @@ -340,6 +386,11 @@ abstract class AbstractResource return null !== $this->parentResourceNode && 0 !== $this->parentResourceNode; } + public function getParentResourceNode(): ?int + { + return $this->parentResourceNode; + } + public function setParentResourceNode(?int $resourceNode): self { $this->parentResourceNode = $resourceNode; @@ -347,11 +398,6 @@ abstract class AbstractResource return $this; } - public function getParentResourceNode(): ?int - { - return $this->parentResourceNode; - } - public function hasUploadFile(): bool { return null !== $this->uploadFile; @@ -369,23 +415,6 @@ abstract class AbstractResource return $this; } - public function setResourceNode(ResourceNode $resourceNode): self - { - $this->resourceNode = $resourceNode; - - return $this; - } - - public function hasResourceNode(): bool - { - return $this->resourceNode instanceof ResourceNode; - } - - public function getResourceNode(): ?ResourceNode - { - return $this->resourceNode; - } - public function getFirstResourceLink(): ?ResourceLink { $resourceNode = $this->getResourceNode(); @@ -481,41 +510,4 @@ abstract class AbstractResource 'groups' => $groups, ]; } - - /** - * This function separates the users from the groups users have a value - * USER:XXX (with XXX the groups id have a value - * GROUP:YYY (with YYY the group id). - * - * @param array $to Array of strings that define the type and id of each destination - * - * @return array Array of groups and users (each an array of IDs) - */ - public static function separateUsersGroups(array $to): array - { - $sendTo = ['groups' => [], 'users' => []]; - - foreach ($to as $toItem) { - if (empty($toItem)) { - continue; - } - - $parts = explode(':', $toItem); - $type = $parts[0] ?? ''; - $id = $parts[1] ?? ''; - - switch ($type) { - case 'GROUP': - $sendTo['groups'][] = (int) $id; - - break; - case 'USER': - $sendTo['users'][] = (int) $id; - - break; - } - } - - return $sendTo; - } } diff --git a/src/CoreBundle/Entity/AccessUrl.php b/src/CoreBundle/Entity/AccessUrl.php index 30d393f332..67dbc046ad 100644 --- a/src/CoreBundle/Entity/AccessUrl.php +++ b/src/CoreBundle/Entity/AccessUrl.php @@ -7,6 +7,7 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\Entity; use ApiPlatform\Core\Annotation\ApiResource; +use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -22,182 +23,125 @@ use Symfony\Component\Validator\Constraints as Assert; * normalizationContext={"groups"={"access_url:read"}, "swagger_definition_name"="Read"}, * denormalizationContext={"groups"={"access_url:write", "course_category:write"}}, * ) - * - * @Gedmo\Tree(type="nested") - * @ORM\Table(name="access_url") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\AccessUrlRepository") */ -class AccessUrl extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'access_url')] +#[Gedmo\Tree(type: 'nested')] +#[ORM\Entity(repositoryClass: AccessUrlRepository::class)] +class AccessUrl extends AbstractResource implements ResourceInterface, \Stringable { public const DEFAULT_ACCESS_URL = 'http://localhost/'; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - * - * @Groups({"access_url:read", "access_url:write"}) - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] + #[Groups(['access_url:read', 'access_url:write'])] protected ?int $id = null; /** * @var AccessUrlRelCourse[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelCourse", mappedBy="url", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: AccessUrlRelCourse::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $courses; /** * @var AccessUrlRelSession[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelSession", mappedBy="url", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: AccessUrlRelSession::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $sessions; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUser", mappedBy="url", cascade={"persist"}, orphanRemoval=true) - * * @var AccessUrlRelUser[]|Collection */ + #[ORM\OneToMany(targetEntity: AccessUrlRelUser::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $users; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SettingsCurrent", mappedBy="url", cascade={"persist"}, orphanRemoval=true) - * * @var Collection|SettingsCurrent[] */ + #[ORM\OneToMany(targetEntity: SettingsCurrent::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $settings; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionCategory", mappedBy="url", cascade={"persist"}, orphanRemoval=true) - * * @var Collection|SessionCategory[] */ + #[ORM\OneToMany(targetEntity: SessionCategory::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $sessionCategories; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelCourseCategory", mappedBy="url", cascade={"persist"}, orphanRemoval=true) - * * @var AccessUrlRelCourseCategory[]|Collection */ + #[ORM\OneToMany(targetEntity: AccessUrlRelCourseCategory::class, mappedBy: 'url', cascade: ['persist'], orphanRemoval: true)] protected Collection $courseCategory; - /** - * @Gedmo\TreeParent - * - * @ORM\ManyToOne( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", - * inversedBy="children" - * ) - * @ORM\JoinColumns({ - * @ORM\JoinColumn(onDelete="CASCADE") - * }) - */ + #[ORM\JoinColumn(onDelete: 'CASCADE')] + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: AccessUrl::class, inversedBy: 'children')] protected ?AccessUrl $parent = null; /** * @var AccessUrl[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", - * mappedBy="parent" - * ) - * @ORM\OrderBy({"id" = "ASC"}) */ + #[ORM\OneToMany(targetEntity: AccessUrl::class, mappedBy: 'parent')] + #[ORM\OrderBy(['id' => 'ASC'])] protected Collection $children; - /** - * @Gedmo\TreeLeft - * @ORM\Column(name="lft", type="integer") - */ + #[Gedmo\TreeLeft] + #[ORM\Column(name: 'lft', type: 'integer')] protected int $lft; - /** - * @Gedmo\TreeLevel - * @ORM\Column(name="lvl", type="integer") - */ + #[Gedmo\TreeLevel] + #[ORM\Column(name: 'lvl', type: 'integer')] protected int $lvl; - /** - * @Gedmo\TreeRight - * @ORM\Column(name="rgt", type="integer") - */ + #[Gedmo\TreeRight] + #[ORM\Column(name: 'rgt', type: 'integer')] protected int $rgt; - /** - * @Gedmo\TreeRoot - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl") - * @ORM\JoinColumn(name="tree_root", onDelete="CASCADE") - */ + #[Gedmo\TreeRoot] + #[ORM\ManyToOne(targetEntity: AccessUrl::class)] + #[ORM\JoinColumn(name: 'tree_root', onDelete: 'CASCADE')] protected ?AccessUrl $root = null; - /** - * @Groups({"access_url:read", "access_url:write"}) - * - * @ORM\Column(name="url", type="string", length=255) - */ #[Assert\NotBlank] + #[Groups(['access_url:read', 'access_url:write'])] + #[ORM\Column(name: 'url', type: 'string', length: 255)] protected string $url; - /** - * @ORM\Column(name="description", type="text") - */ + #[ORM\Column(name: 'description', type: 'text')] protected ?string $description = null; - /** - * @ORM\Column(name="active", type="integer") - */ + #[ORM\Column(name: 'active', type: 'integer')] protected int $active; - /** - * @ORM\Column(name="created_by", type="integer") - */ + #[ORM\Column(name: 'created_by', type: 'integer')] protected int $createdBy; - /** - * @ORM\Column(name="tms", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'tms', type: 'datetime', nullable: true)] protected ?DateTime $tms; - /** - * @ORM\Column(name="url_type", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'url_type', type: 'boolean', nullable: true)] protected ?bool $urlType = null; - /** - * @ORM\Column(name="limit_courses", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_courses', type: 'integer', nullable: true)] protected ?int $limitCourses = null; - /** - * @ORM\Column(name="limit_active_courses", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_active_courses', type: 'integer', nullable: true)] protected ?int $limitActiveCourses = null; - /** - * @ORM\Column(name="limit_sessions", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_sessions', type: 'integer', nullable: true)] protected ?int $limitSessions = null; - /** - * @ORM\Column(name="limit_users", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_users', type: 'integer', nullable: true)] protected ?int $limitUsers = null; - /** - * @ORM\Column(name="limit_teachers", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_teachers', type: 'integer', nullable: true)] protected ?int $limitTeachers = null; - /** - * @ORM\Column(name="limit_disk_space", type="integer", nullable=true) - */ + #[ORM\Column(name: 'limit_disk_space', type: 'integer', nullable: true)] protected ?int $limitDiskSpace = null; - /** - * @ORM\Column(name="email", type="string", length=255, nullable=true) - */ #[Assert\Email] + #[ORM\Column(name: 'email', type: 'string', length: 255, nullable: true)] protected ?string $email = null; public function __construct() @@ -409,7 +353,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return Collection|SettingsCurrent[] */ - public function getSettings() + public function getSettings(): \Doctrine\Common\Collections\Collection|array { return $this->settings; } @@ -417,7 +361,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @param Collection|SettingsCurrent[] $settings */ - public function setSettings(Collection $settings): self + public function setSettings(\Doctrine\Common\Collections\Collection|array $settings): self { $this->settings = $settings; @@ -442,7 +386,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return Collection|AccessUrlRelCourse[] */ - public function getCourses() + public function getCourses(): \Doctrine\Common\Collections\Collection|array { return $this->courses; } @@ -450,7 +394,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @param AccessUrlRelCourse[]|Collection $courses */ - public function setCourses(Collection $courses): self + public function setCourses(array|\Doctrine\Common\Collections\Collection $courses): self { $this->courses = $courses; @@ -460,7 +404,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return SessionCategory[]|Collection */ - public function getSessionCategories() + public function getSessionCategories(): array|\Doctrine\Common\Collections\Collection { return $this->sessionCategories; } @@ -468,7 +412,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @param Collection|SessionCategory[] $sessionCategories */ - public function setSessionCategories(Collection $sessionCategories): self + public function setSessionCategories(\Doctrine\Common\Collections\Collection|array $sessionCategories): self { $this->sessionCategories = $sessionCategories; @@ -478,7 +422,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return AccessUrlRelSession[]|Collection */ - public function getSessions() + public function getSessions(): array|\Doctrine\Common\Collections\Collection { return $this->sessions; } @@ -486,7 +430,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return AccessUrl[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } @@ -494,7 +438,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return AccessUrlRelUser[]|Collection */ - public function getUsers() + public function getUsers(): array|\Doctrine\Common\Collections\Collection { return $this->users; } @@ -534,7 +478,7 @@ class AccessUrl extends AbstractResource implements ResourceInterface /** * @return AccessUrlRelCourseCategory[]|Collection */ - public function getCourseCategory() + public function getCourseCategory(): array|\Doctrine\Common\Collections\Collection { return $this->courseCategory; } diff --git a/src/CoreBundle/Entity/AccessUrlRelCourse.php b/src/CoreBundle/Entity/AccessUrlRelCourse.php index bccef149b7..3759800d58 100644 --- a/src/CoreBundle/Entity/AccessUrlRelCourse.php +++ b/src/CoreBundle/Entity/AccessUrlRelCourse.php @@ -8,34 +8,28 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\CoreBundle\Traits\CourseTrait; use Doctrine\ORM\Mapping as ORM; +use Stringable; /** * AccessUrlRelCourse. - * - * @ORM\Table(name="access_url_rel_course") - * @ORM\Entity */ -class AccessUrlRelCourse implements EntityAccessUrlInterface +#[ORM\Table(name: 'access_url_rel_course')] +#[ORM\Entity] +class AccessUrlRelCourse implements EntityAccessUrlInterface, Stringable { use CourseTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="urls", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Course::class, cascade: ['persist'], inversedBy: 'urls')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="courses", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, cascade: ['persist'], inversedBy: 'courses')] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; public function __toString(): string @@ -45,14 +39,17 @@ class AccessUrlRelCourse implements EntityAccessUrlInterface /** * Get id. - * - * @return int */ - public function getId() + public function getId(): ?int { return $this->id; } + public function getUrl(): AccessUrl + { + return $this->url; + } + public function setUrl(AccessUrl $url): self { $this->url = $url; @@ -60,11 +57,6 @@ class AccessUrlRelCourse implements EntityAccessUrlInterface return $this; } - public function getUrl(): AccessUrl - { - return $this->url; - } - public function getCourse(): Course { return $this->course; diff --git a/src/CoreBundle/Entity/AccessUrlRelCourseCategory.php b/src/CoreBundle/Entity/AccessUrlRelCourseCategory.php index 16d76a8418..afbe3dc654 100644 --- a/src/CoreBundle/Entity/AccessUrlRelCourseCategory.php +++ b/src/CoreBundle/Entity/AccessUrlRelCourseCategory.php @@ -10,29 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * AccessUrlRelCourseCategory. - * - * @ORM\Table(name="access_url_rel_course_category") - * @ORM\Entity */ +#[ORM\Table(name: 'access_url_rel_course_category')] +#[ORM\Entity] class AccessUrlRelCourseCategory implements EntityAccessUrlInterface { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="courseCategory", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, cascade: ['persist'], inversedBy: 'courseCategory')] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\CourseCategory", inversedBy="urls", cascade={"persist"}) - * @ORM\JoinColumn(name="course_category_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CourseCategory::class, cascade: ['persist'], inversedBy: 'urls')] + #[ORM\JoinColumn(name: 'course_category_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected CourseCategory $courseCategory; public function getUrl(): AccessUrl diff --git a/src/CoreBundle/Entity/AccessUrlRelSession.php b/src/CoreBundle/Entity/AccessUrlRelSession.php index 3f6bb34982..9d2e5a3c8c 100644 --- a/src/CoreBundle/Entity/AccessUrlRelSession.php +++ b/src/CoreBundle/Entity/AccessUrlRelSession.php @@ -10,29 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * AccessUrlRelSession. - * - * @ORM\Table(name="access_url_rel_session") - * @ORM\Entity */ +#[ORM\Table(name: 'access_url_rel_session')] +#[ORM\Entity] class AccessUrlRelSession implements EntityAccessUrlInterface { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="urls", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Session::class, inversedBy: 'urls', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id')] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="sessions", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, inversedBy: 'sessions', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected ?AccessUrl $url = null; /** diff --git a/src/CoreBundle/Entity/AccessUrlRelUser.php b/src/CoreBundle/Entity/AccessUrlRelUser.php index eac3585bf7..f5406a4513 100644 --- a/src/CoreBundle/Entity/AccessUrlRelUser.php +++ b/src/CoreBundle/Entity/AccessUrlRelUser.php @@ -8,39 +8,28 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; - -/** - * @ORM\Table( - * name="access_url_rel_user", - * indexes={ - * @ORM\Index(name="idx_access_url_rel_user_user", columns={"user_id"}), - * @ORM\Index(name="idx_access_url_rel_user_access_url", columns={"access_url_id"}), - * @ORM\Index(name="idx_access_url_rel_user_access_url_user", columns={"user_id", "access_url_id"}) - * } - * ) - * @ORM\Entity - */ -class AccessUrlRelUser implements EntityAccessUrlInterface +use Stringable; + +#[ORM\Table(name: 'access_url_rel_user')] +#[ORM\Index(name: 'idx_access_url_rel_user_user', columns: ['user_id'])] +#[ORM\Index(name: 'idx_access_url_rel_user_access_url', columns: ['access_url_id'])] +#[ORM\Index(name: 'idx_access_url_rel_user_access_url_user', columns: ['user_id', 'access_url_id'])] +#[ORM\Entity] +class AccessUrlRelUser implements EntityAccessUrlInterface, Stringable { use UserTrait; - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(name="id", type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(name: 'id', type: 'integer')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="portals") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'portals')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="users", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, cascade: ['persist'], inversedBy: 'users')] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; public function __toString(): string diff --git a/src/CoreBundle/Entity/AccessUrlRelUserGroup.php b/src/CoreBundle/Entity/AccessUrlRelUserGroup.php index c9039f2cb6..0408e827a9 100644 --- a/src/CoreBundle/Entity/AccessUrlRelUserGroup.php +++ b/src/CoreBundle/Entity/AccessUrlRelUserGroup.php @@ -10,29 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * AccessUrlRelUser. - * - * @ORM\Table(name="access_url_rel_usergroup") - * @ORM\Entity */ +#[ORM\Table(name: 'access_url_rel_usergroup')] +#[ORM\Entity] class AccessUrlRelUserGroup implements EntityAccessUrlInterface { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl") - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class)] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup", inversedBy="urls", cascade={"persist"}) - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Usergroup::class, inversedBy: 'urls', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Usergroup $userGroup; /** diff --git a/src/CoreBundle/Entity/Admin.php b/src/CoreBundle/Entity/Admin.php index dd0b14c1b1..8814f0d9c3 100644 --- a/src/CoreBundle/Entity/Admin.php +++ b/src/CoreBundle/Entity/Admin.php @@ -11,25 +11,20 @@ use Doctrine\ORM\Mapping as ORM; /** * Admin list. - * - * @ORM\Table(name="admin") - * @ORM\Entity */ +#[ORM\Table(name: 'admin')] +#[ORM\Entity] class Admin { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="admin") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\OneToOne(targetEntity: User::class, inversedBy: 'admin')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; /** diff --git a/src/CoreBundle/Entity/AnnouncementRelGroup.php b/src/CoreBundle/Entity/AnnouncementRelGroup.php index dc852f218d..6da7905b89 100644 --- a/src/CoreBundle/Entity/AnnouncementRelGroup.php +++ b/src/CoreBundle/Entity/AnnouncementRelGroup.php @@ -8,24 +8,18 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="announcement_rel_group") - * @ORM\Entity - */ +#[ORM\Table(name: 'announcement_rel_group')] +#[ORM\Entity] class AnnouncementRelGroup { - /** - * @ORM\Column(name="group_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'group_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected int $groupId; - /** - * @ORM\Column(name="announcement_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'announcement_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected int $announcementId; /** diff --git a/src/CoreBundle/Entity/Asset.php b/src/CoreBundle/Entity/Asset.php index 7b0be59ce1..2165968782 100644 --- a/src/CoreBundle/Entity/Asset.php +++ b/src/CoreBundle/Entity/Asset.php @@ -20,10 +20,10 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich; /** * @Vich\Uploadable - * @ORM\Entity - * @ORM\Table(name="asset") */ -class Asset +#[ORM\Table(name: 'asset')] +#[ORM\Entity] +class Asset implements \Stringable { use TimestampableEntity; @@ -36,32 +36,17 @@ class Asset public const EXERCISE_ATTEMPT = 'exercise_attempt'; public const EXERCISE_FEEDBACK = 'exercise_feedback'; - /** - * @ORM\Id - * @ORM\Column(type="uuid") - */ + #[ORM\Id] + #[ORM\Column(type: 'uuid')] protected Uuid $id; - /** - * @ORM\Column(type="string", length=255) - */ #[Assert\NotBlank] + #[ORM\Column(type: 'string', length: 255)] protected ?string $title = null; - /** - * @Assert\Choice({ - * Asset::SCORM, - * Asset::WATERMARK, - * Asset::EXTRA_FIELD, - * Asset::COURSE_CATEGORY, - * Asset::SKILL, - * }, - * message="Choose a valid category." - * ) - * - * @ORM\Column(type="string", length=255) - */ #[Assert\NotBlank] + #[Assert\Choice([Asset::SCORM, Asset::WATERMARK, Asset::EXTRA_FIELD, Asset::COURSE_CATEGORY, Asset::SKILL], message: 'Choose a valid category.')] + #[ORM\Column(type: 'string', length: 255)] protected ?string $category = null; /** @@ -74,64 +59,48 @@ class Asset * dimensions="dimensions" * ) */ -// #[Vich\UploadableField( -// mapping: 'assets', -// fileNameProperty: 'title', -// size: 'size', -// mimeType: 'mimeType', -// originalName: 'originalName', -// dimensions: 'dimensions' -// )] + // #[Vich\UploadableField( + // mapping: 'assets', + // fileNameProperty: 'title', + // size: 'size', + // mimeType: 'mimeType', + // originalName: 'originalName', + // dimensions: 'dimensions' + // )] #[Assert\NotNull] protected File $file; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: 'boolean')] protected bool $compressed; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read"}) - * @ORM\Column(type="text", nullable=true) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read'])] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $mimeType = null; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: 'text', nullable: true)] protected ?string $originalName = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read"}) - * @ORM\Column(type="simple_array", nullable=true) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read'])] + #[ORM\Column(type: 'simple_array', nullable: true)] protected ?array $dimensions; - /** - * @ORM\Column(type="integer") - */ + #[ORM\Column(type: 'integer')] protected ?int $size = null; - /** - * @ORM\Column(name="crop", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'crop', type: 'string', length: 255, nullable: true)] protected ?string $crop = null; - /** - * @ORM\Column(type="array", nullable=true) - */ + #[ORM\Column(type: 'array', nullable: true)] protected ?array $metadata; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** * @var DateTime|DateTimeImmutable - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected $updatedAt; public function __construct() @@ -295,7 +264,7 @@ class Asset /** * @param File|UploadedFile $file */ - public function setFile(File $file = null): self + public function setFile(File|UploadedFile $file = null): self { $this->file = $file; diff --git a/src/CoreBundle/Entity/AttemptFeedback.php b/src/CoreBundle/Entity/AttemptFeedback.php index 37a9931130..da8fed77a5 100644 --- a/src/CoreBundle/Entity/AttemptFeedback.php +++ b/src/CoreBundle/Entity/AttemptFeedback.php @@ -11,45 +11,31 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Uid\Uuid; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="attempt_feedback", - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'attempt_feedback')] +#[ORM\Entity] class AttemptFeedback { use TimestampableEntity; - /** - * @ORM\Id - * @ORM\Column(type="uuid") - */ + #[ORM\Id] + #[ORM\Column(type: 'uuid')] protected Uuid $id; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", inversedBy="attemptFeedbacks") - * @ORM\JoinColumn(name="attempt_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TrackEAttempt::class, inversedBy: 'attemptFeedbacks')] + #[ORM\JoinColumn(name: 'attempt_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected TrackEAttempt $attempt; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"remove"} ) - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Asset::class, cascade: ['remove'])] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Asset $asset = null; - /** - * @ORM\Column(name="comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: false)] protected string $comment; public function __construct() diff --git a/src/CoreBundle/Entity/AttemptFile.php b/src/CoreBundle/Entity/AttemptFile.php index fb83a15e91..19f6e10e54 100644 --- a/src/CoreBundle/Entity/AttemptFile.php +++ b/src/CoreBundle/Entity/AttemptFile.php @@ -11,38 +11,26 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Uid\Uuid; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="attempt_file", - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'attempt_file')] +#[ORM\Entity] class AttemptFile { use TimestampableEntity; - /** - * @ORM\Id - * @ORM\Column(type="uuid") - */ + #[ORM\Id] + #[ORM\Column(type: 'uuid')] protected Uuid $id; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", inversedBy="attemptFiles") - * @ORM\JoinColumn(name="attempt_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: TrackEAttempt::class, inversedBy: 'attemptFiles')] + #[ORM\JoinColumn(name: 'attempt_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected TrackEAttempt $attempt; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"remove"} ) - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE") - */ - protected ?Asset $asset; + #[ORM\ManyToOne(targetEntity: Asset::class, cascade: ['remove'])] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + protected ?Asset $asset = null; - /** - * @ORM\Column(name="comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: false)] protected string $comment; public function __construct() diff --git a/src/CoreBundle/Entity/BranchSync.php b/src/CoreBundle/Entity/BranchSync.php index 6dcf886c72..2193e15aca 100644 --- a/src/CoreBundle/Entity/BranchSync.php +++ b/src/CoreBundle/Entity/BranchSync.php @@ -6,6 +6,7 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\Entity; +use Chamilo\CoreBundle\Repository\BranchSyncRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -14,148 +15,99 @@ use Gedmo\Mapping\Annotation as Gedmo; /** * BranchSync. - * - * @ORM\Table(name="branch_sync") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\BranchSyncRepository") - * @Gedmo\Tree(type="nested") */ +#[ORM\Table(name: 'branch_sync')] +#[ORM\Entity(repositoryClass: BranchSyncRepository::class)] +#[Gedmo\Tree(type: 'nested')] class BranchSync { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; - /** - * @ORM\Column(name="unique_id", type="string", length=50, nullable=false, unique=true) - */ + #[ORM\Column(name: 'unique_id', type: 'string', length: 50, nullable: false, unique: true)] protected string $uniqueId; - /** - * @ORM\Column(name="branch_name", type="string", length=250) - */ + #[ORM\Column(name: 'branch_name', type: 'string', length: 250)] protected string $branchName; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="branch_ip", type="string", length=40, nullable=true, unique=false) - */ + #[ORM\Column(name: 'branch_ip', type: 'string', length: 40, nullable: true, unique: false)] protected ?string $branchIp = null; - /** - * @ORM\Column(name="latitude", type="decimal", nullable=true, unique=false) - */ + #[ORM\Column(name: 'latitude', type: 'decimal', nullable: true, unique: false)] protected ?float $latitude = null; - /** - * @ORM\Column(name="longitude", type="decimal", nullable=true, unique=false) - */ + #[ORM\Column(name: 'longitude', type: 'decimal', nullable: true, unique: false)] protected ?float $longitude = null; - /** - * @ORM\Column(name="dwn_speed", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'dwn_speed', type: 'integer', nullable: true, unique: false)] protected ?int $dwnSpeed = null; - /** - * @ORM\Column(name="up_speed", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'up_speed', type: 'integer', nullable: true, unique: false)] protected ?int $upSpeed = null; - /** - * @ORM\Column(name="delay", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'delay', type: 'integer', nullable: true, unique: false)] protected ?int $delay = null; - /** - * @ORM\Column(name="admin_mail", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'admin_mail', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $adminMail = null; - /** - * @ORM\Column(name="admin_name", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'admin_name', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $adminName = null; - /** - * @ORM\Column(name="admin_phone", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'admin_phone', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $adminPhone = null; - /** - * @ORM\Column(name="last_sync_trans_id", type="bigint", nullable=true, unique=false) - */ + #[ORM\Column(name: 'last_sync_trans_id', type: 'bigint', nullable: true, unique: false)] protected ?int $lastSyncTransId = null; - /** - * @ORM\Column(name="last_sync_trans_date", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'last_sync_trans_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastSyncTransDate = null; - /** - * @ORM\Column(name="last_sync_type", type="string", length=20, nullable=true, unique=false) - */ + #[ORM\Column(name: 'last_sync_type', type: 'string', length: 20, nullable: true, unique: false)] protected ?string $lastSyncType = null; - /** - * @ORM\Column(name="ssl_pub_key", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'ssl_pub_key', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $sslPubKey; - /** - * @ORM\Column(name="branch_type", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'branch_type', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $branchType = null; - /** - * @Gedmo\TreeLeft - * @ORM\Column(name="lft", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeLeft] + #[ORM\Column(name: 'lft', type: 'integer', nullable: true, unique: false)] protected ?int $lft = null; - /** - * @Gedmo\TreeRight - * @ORM\Column(name="rgt", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeRight] + #[ORM\Column(name: 'rgt', type: 'integer', nullable: true, unique: false)] protected ?int $rgt = null; - /** - * @Gedmo\TreeLevel - * @ORM\Column(name="lvl", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeLevel] + #[ORM\Column(name: 'lvl', type: 'integer', nullable: true, unique: false)] protected ?int $lvl = null; - /** - * @Gedmo\TreeRoot - * @ORM\Column(name="root", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeRoot] + #[ORM\Column(name: 'root', type: 'integer', nullable: true, unique: false)] protected ?int $root = null; - /** - * @Gedmo\TreeParent - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\BranchSync", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: BranchSync::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?BranchSync $parent = null; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\BranchSync", mappedBy="parent") - * @ORM\OrderBy({"lft"="ASC"}) * * @var BranchSync[]|Collection */ + #[ORM\OneToMany(targetEntity: BranchSync::class, mappedBy: 'parent')] + #[ORM\OrderBy(['lft' => 'ASC'])] protected Collection $children; public function __construct() @@ -626,7 +578,7 @@ class BranchSync /** * @return BranchSync[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } diff --git a/src/CoreBundle/Entity/BranchTransaction.php b/src/CoreBundle/Entity/BranchTransaction.php index ce94cd27c5..0b1eb3defe 100644 --- a/src/CoreBundle/Entity/BranchTransaction.php +++ b/src/CoreBundle/Entity/BranchTransaction.php @@ -11,74 +11,49 @@ use Doctrine\ORM\Mapping as ORM; /** * BranchTransaction. - * - * @ORM\Table(name="branch_transaction") - * @ORM\Entity */ +#[ORM\Table(name: 'branch_transaction')] +#[ORM\Entity] class BranchTransaction { - /** - * @ORM\Column(name="id", type="bigint", nullable=false) - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'bigint', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\BranchTransactionStatus") - * @ORM\JoinColumn(name="status_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: BranchTransactionStatus::class)] + #[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id')] protected Room $branchTransactionStatus; - /** - * @ORM\Column(name="transaction_id", type="bigint") - */ + #[ORM\Column(name: 'transaction_id', type: 'bigint')] protected int $externalTransactionId; - /** - * @ORM\Column(name="action", type="string", length=20, nullable=true, unique=false) - */ + #[ORM\Column(name: 'action', type: 'string', length: 20, nullable: true, unique: false)] protected ?string $action = null; - /** - * @ORM\Column(name="item_id", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'item_id', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $itemId = null; - /** - * @ORM\Column(name="origin", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'origin', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $origin = null; - /** - * @ORM\Column(name="dest_id", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'dest_id', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $destId = null; - /** - * @ORM\Column(name="external_info", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'external_info', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $externalInfo = null; - /** - * @ORM\Column(name="time_insert", type="datetime") - */ + #[ORM\Column(name: 'time_insert', type: 'datetime')] protected DateTime $timeInsert; - /** - * @ORM\Column(name="time_update", type="datetime") - */ + #[ORM\Column(name: 'time_update', type: 'datetime')] protected DateTime $timeUpdate; - /** - * @ORM\Column(name="failed_attempts", type="integer") - */ + #[ORM\Column(name: 'failed_attempts', type: 'integer')] protected int $failedAttempts; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\BranchSync") - * @ORM\JoinColumn(name="branch_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: BranchSync::class)] + #[ORM\JoinColumn(name: 'branch_id', referencedColumnName: 'id')] protected BranchSync $branch; /** diff --git a/src/CoreBundle/Entity/BranchTransactionStatus.php b/src/CoreBundle/Entity/BranchTransactionStatus.php index 2a9d9cb28a..8d85790d18 100644 --- a/src/CoreBundle/Entity/BranchTransactionStatus.php +++ b/src/CoreBundle/Entity/BranchTransactionStatus.php @@ -10,22 +10,17 @@ use Doctrine\ORM\Mapping as ORM; /** * BranchTransactionStatus. - * - * @ORM\Table(name="branch_transaction_status") - * @ORM\Entity */ +#[ORM\Table(name: 'branch_transaction_status')] +#[ORM\Entity] class BranchTransactionStatus { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false, unique=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false, unique: false)] protected string $title; /** diff --git a/src/CoreBundle/Entity/Career.php b/src/CoreBundle/Entity/Career.php index 13e54318b9..cdac693916 100644 --- a/src/CoreBundle/Entity/Career.php +++ b/src/CoreBundle/Entity/Career.php @@ -14,10 +14,9 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Career. - * - * @ORM\Table(name="career") - * @ORM\Entity */ +#[ORM\Table(name: 'career')] +#[ORM\Entity] class Career { use TimestampableEntity; @@ -25,36 +24,25 @@ class Career public const CAREER_STATUS_ACTIVE = 1; public const CAREER_STATUS_INACTIVE = 0; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected ?string $description = null; - /** - * @ORM\Column(name="status", type="integer", nullable=false) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: false)] protected int $status; /** * @var Collection|Promotion[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\Promotion", mappedBy="career", cascade={"persist"} - * ) */ + #[ORM\OneToMany(targetEntity: Promotion::class, mappedBy: 'career', cascade: ['persist'])] protected Collection $promotions; public function __construct() diff --git a/src/CoreBundle/Entity/Chat.php b/src/CoreBundle/Entity/Chat.php index 497be1e79c..9e99750189 100644 --- a/src/CoreBundle/Entity/Chat.php +++ b/src/CoreBundle/Entity/Chat.php @@ -11,45 +11,31 @@ use Doctrine\ORM\Mapping as ORM; /** * Chat. - * - * @ORM\Table(name="chat", indexes={ - * @ORM\Index(name="idx_chat_to_user", columns={"to_user"}), - * @ORM\Index(name="idx_chat_from_user", columns={"from_user"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'chat')] +#[ORM\Index(name: 'idx_chat_to_user', columns: ['to_user'])] +#[ORM\Index(name: 'idx_chat_from_user', columns: ['from_user'])] +#[ORM\Entity] class Chat { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="from_user", type="integer", nullable=true) - */ + #[ORM\Column(name: 'from_user', type: 'integer', nullable: true)] protected ?int $fromUser = null; - /** - * @ORM\Column(name="to_user", type="integer", nullable=true) - */ + #[ORM\Column(name: 'to_user', type: 'integer', nullable: true)] protected ?int $toUser = null; - /** - * @ORM\Column(name="message", type="text", nullable=false) - */ + #[ORM\Column(name: 'message', type: 'text', nullable: false)] protected string $message; - /** - * @ORM\Column(name="sent", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'sent', type: 'datetime', nullable: false)] protected DateTime $sent; - /** - * @ORM\Column(name="recd", type="integer", nullable=false) - */ + #[ORM\Column(name: 'recd', type: 'integer', nullable: false)] protected int $recd; /** diff --git a/src/CoreBundle/Entity/ChatVideo.php b/src/CoreBundle/Entity/ChatVideo.php index 6c219ddd97..013baf3603 100644 --- a/src/CoreBundle/Entity/ChatVideo.php +++ b/src/CoreBundle/Entity/ChatVideo.php @@ -11,46 +11,30 @@ use Doctrine\ORM\Mapping as ORM; /** * Chat. - * - * @ORM\Table( - * name="chat_video", - * options={"row_format"="DYNAMIC"}, - * indexes={ - * @ORM\Index(name="idx_chat_video_to_user", columns={"to_user"}), - * @ORM\Index(name="idx_chat_video_from_user", columns={"from_user"}), - * @ORM\Index(name="idx_chat_video_users", columns={"from_user", "to_user"}), - * @ORM\Index(name="idx_chat_video_room_name", columns={"room_name"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'chat_video', options: ['row_format' => 'DYNAMIC'])] +#[ORM\Index(name: 'idx_chat_video_to_user', columns: ['to_user'])] +#[ORM\Index(name: 'idx_chat_video_from_user', columns: ['from_user'])] +#[ORM\Index(name: 'idx_chat_video_users', columns: ['from_user', 'to_user'])] +#[ORM\Index(name: 'idx_chat_video_room_name', columns: ['room_name'])] +#[ORM\Entity] class ChatVideo { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="from_user", type="integer", nullable=false) - */ + #[ORM\Column(name: 'from_user', type: 'integer', nullable: false)] protected int $fromUser; - /** - * @ORM\Column(name="to_user", type="integer", nullable=false) - */ + #[ORM\Column(name: 'to_user', type: 'integer', nullable: false)] protected int $toUser; - /** - * @ORM\Column(name="room_name", type="string", nullable=false) - */ + #[ORM\Column(name: 'room_name', type: 'string', nullable: false)] protected string $roomName; - /** - * @ORM\Column(name="datetime", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'datetime', type: 'datetime', nullable: false)] protected DateTime $datetime; /** diff --git a/src/CoreBundle/Entity/Course.php b/src/CoreBundle/Entity/Course.php index 79c7f86df8..5be41081ae 100644 --- a/src/CoreBundle/Entity/Course.php +++ b/src/CoreBundle/Entity/Course.php @@ -14,6 +14,9 @@ use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Serializer\Filter\PropertyFilter; +use Chamilo\CoreBundle\Entity\Listener\CourseListener; +use Chamilo\CoreBundle\Entity\Listener\ResourceListener; +use Chamilo\CoreBundle\Repository\Node\CourseRepository; use Chamilo\CourseBundle\Entity\CGroup; use Chamilo\CourseBundle\Entity\CTool; use DateTime; @@ -26,17 +29,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="course", - * indexes={ - * } - * ) - * @UniqueEntity("code") - * @UniqueEntity("visualCode") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\CourseRepository") - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\ResourceListener", "Chamilo\CoreBundle\Entity\Listener\CourseListener"}) - */ #[ApiResource( iri: 'https://schema.org/Course', attributes: [ @@ -67,8 +59,13 @@ use Symfony\Component\Validator\Constraints as Assert; //#[ApiFilter(BooleanFilter::class, properties: ['isSticky'])] #[ApiFilter(PropertyFilter::class)] #[ApiFilter(OrderFilter::class, properties: ['id', 'title'])] +#[ORM\Table(name: 'course')] +#[UniqueEntity('code')] +#[UniqueEntity('visualCode')] +#[ORM\Entity(repositoryClass: CourseRepository::class)] +#[ORM\EntityListeners([ResourceListener::class, CourseListener::class])] -class Course extends AbstractResource implements ResourceInterface, ResourceWithAccessUrlInterface, ResourceIllustrationInterface, ExtraFieldItemInterface +class Course extends AbstractResource implements ResourceInterface, ResourceWithAccessUrlInterface, ResourceIllustrationInterface, ExtraFieldItemInterface, \Stringable { public const CLOSED = 0; public const REGISTERED = 1; // Only registered users in the course. @@ -76,11 +73,6 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith public const OPEN_WORLD = 3; public const HIDDEN = 4; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - */ #[Groups([ 'course:read', 'course_rel_user:read', @@ -90,12 +82,13 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith 'session_rel_course:read', 'track_e_exercise:read', ])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; /** * The course title. - * - * @ORM\Column(name="title", type="string", length=250, nullable=true, unique=false) */ #[Groups([ 'course:read', @@ -107,37 +100,24 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith 'session_rel_course:read', ])] #[Assert\NotBlank(message: 'A Course requires a title')] + #[ORM\Column(name: 'title', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $title = null; /** * The course code. * - * @Assert\Length( - * max = 40, - * maxMessage = "Code cannot be longer than {{ limit }} characters" - * ) * @ApiProperty(iri="http://schema.org/courseCode") * - * @Gedmo\Slug( - * fields={"title"}, - * updatable=false, - * unique=true, - * separator="", - * style="upper" - * ) - * @ORM\Column(name="code", type="string", length=40, nullable=false, unique=true) */ #[Groups(['course:read', 'user:write', 'course_rel_user:read'])] #[Assert\NotBlank] + #[Assert\Length(max: 40, maxMessage: 'Code cannot be longer than {{ limit }} characters')] + #[Gedmo\Slug(fields: ['title'], updatable: false, unique: true, separator: '', style: 'upper')] + #[ORM\Column(name: 'code', type: 'string', length: 40, nullable: false, unique: true)] protected string $code; - /** - * @Assert\Length( - * max = 40, - * maxMessage = "Code cannot be longer than {{ limit }} characters" - * ) - * @ORM\Column(name="visual_code", type="string", length=40, nullable=true, unique=false) - */ + #[Assert\Length(max: 40, maxMessage: 'Code cannot be longer than {{ limit }} characters')] + #[ORM\Column(name: 'visual_code', type: 'string', length: 40, nullable: true, unique: false)] protected ?string $visualCode = null; /** @@ -146,11 +126,10 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith * "orphanRemoval" is needed to delete the CourseRelUser relation * in the CourseAdmin class. The setUsers, getUsers, removeUsers and * addUsers methods need to be added. - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="course", cascade={"persist"}, orphanRemoval=true) */ #[Groups(['course:read', 'user:read'])] #[ApiSubresource] + #[ORM\OneToMany(targetEntity: CourseRelUser::class, mappedBy: 'course', cascade: ['persist'], orphanRemoval: true)] protected Collection $users; /** @@ -159,57 +138,41 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith * "orphanRemoval" is needed to delete the CourseRelUser relation * in the CourseAdmin class. The setUsers, getUsers, removeUsers and * addUsers methods need to be added. - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="course", cascade={"persist"}) */ #[Groups(['course:read', 'user:read'])] + #[ORM\OneToMany(targetEntity: CourseRelUser::class, mappedBy: 'course', cascade: ['persist'])] protected Collection $teachers; /** * @var AccessUrlRelCourse[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelCourse", - * mappedBy="course", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: AccessUrlRelCourse::class, mappedBy: 'course', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $urls; /** * @var Collection|SessionRelCourse[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourse", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: SessionRelCourse::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $sessions; /** * @var Collection|SessionRelCourseRelUser[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\SessionRelCourseRelUser::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $sessionRelCourseRelUsers; /** * @var Collection|CTool[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CTool", - * mappedBy="course", - * cascade={"persist", "remove"} - * ) */ #[Groups(['course:read'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CTool::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $tools; /** * @var TrackCourseRanking - * - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\TrackCourseRanking", - * mappedBy="course", - * cascade={"persist", "remove"}, - * orphanRemoval=true) */ #[Groups(['course:read'])] + #[ORM\OneToOne(targetEntity: TrackCourseRanking::class, mappedBy: 'course', cascade: ['persist', 'remove'], orphanRemoval: true)] protected TrackCourseRanking|null $trackCourseRanking = null; protected Session $currentSession; @@ -217,217 +180,158 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @var Collection|SkillRelCourse[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelCourse", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: SkillRelCourse::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $skills; /** * @var Collection|SkillRelUser[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: SkillRelUser::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $issuedSkills; /** * @var Collection|GradebookCategory[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: GradebookCategory::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $gradebookCategories; /** * @var Collection|GradebookEvaluation[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: GradebookEvaluation::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $gradebookEvaluations; /** * @var Collection|GradebookLink[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: GradebookLink::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $gradebookLinks; /** * @var Collection|TrackEHotspot[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEHotspot", mappedBy="course", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: TrackEHotspot::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $trackEHotspots; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SearchEngineRef", mappedBy="course", cascade={"persist", "remove"}) - * * @var SearchEngineRef[]|Collection */ + #[ORM\OneToMany(targetEntity: SearchEngineRef::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $searchEngineRefs; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Templates", mappedBy="course", cascade={"persist", "remove"}) - * * @var Templates[]|Collection */ + #[ORM\OneToMany(targetEntity: Templates::class, mappedBy: 'course', cascade: ['persist', 'remove'])] protected Collection $templates; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SpecificFieldValues", mappedBy="course") + * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SpecificFieldValues", mappedBy="course") */ //protected $specificFieldValues; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SharedSurvey", mappedBy="course") + * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SharedSurvey", mappedBy="course") */ //protected $sharedSurveys; - /** - * @ORM\Column(name="directory", type="string", length=40, nullable=true, unique=false) - */ + #[ORM\Column(name: 'directory', type: 'string', length: 40, nullable: true, unique: false)] protected ?string $directory = null; - /** - * @ORM\Column(name="course_language", type="string", length=20, nullable=false, unique=false) - */ #[Groups(['course:read', 'session:read'])] #[Assert\NotBlank] + #[ORM\Column(name: 'course_language', type: 'string', length: 20, nullable: false, unique: false)] protected string $courseLanguage; - /** - * @ORM\Column(name="description", type="text", nullable=true, unique=false) - */ #[Groups(['course:read', 'course_rel_user:read'])] + #[ORM\Column(name: 'description', type: 'text', nullable: true, unique: false)] protected ?string $description; - /** - * @ORM\Column(name="introduction", type="text", nullable=true) - */ #[Groups(['course:read', 'course_rel_user:read'])] + #[ORM\Column(name: 'introduction', type: 'text', nullable: true)] protected ?string $introduction; /** * @var CourseCategory[]|Collection - * - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseCategory", inversedBy="courses") - * @ORM\JoinTable( - * name="course_rel_category", - * joinColumns={ - * @ORM\JoinColumn(name="course_id", referencedColumnName="id") - * }, - * inverseJoinColumns={ - * @ORM\JoinColumn(name="course_category_id", referencedColumnName="id")} - * ) */ #[ApiSubresource] #[Groups(['course:read', 'course:write', 'course_rel_user:read', 'session:read'])] + #[ORM\JoinTable(name: 'course_rel_category')] + #[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'id')] + #[ORM\InverseJoinColumn(name: 'course_category_id', referencedColumnName: 'id')] + #[ORM\ManyToMany(targetEntity: CourseCategory::class, inversedBy: 'courses')] protected Collection $categories; /** * @var int Course visibility - * - * @ORM\Column(name="visibility", type="integer", nullable=false, unique=false) */ #[Assert\NotBlank] #[Groups(['course:read', 'course:write'])] + #[ORM\Column(name: 'visibility', type: 'integer', nullable: false, unique: false)] protected int $visibility; - /** - * @ORM\Column(name="show_score", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'show_score', type: 'integer', nullable: true, unique: false)] protected ?int $showScore = null; - /** - * @ORM\Column(name="tutor_name", type="string", length=200, nullable=true, unique=false) - */ + #[ORM\Column(name: 'tutor_name', type: 'string', length: 200, nullable: true, unique: false)] protected ?string $tutorName; - /** - * @ORM\Column(name="department_name", type="string", length=30, nullable=true, unique=false) - */ #[Groups(['course:read'])] + #[ORM\Column(name: 'department_name', type: 'string', length: 30, nullable: true, unique: false)] protected ?string $departmentName = null; - /** - * @ORM\Column(name="department_url", type="string", length=180, nullable=true, unique=false) - */ #[Assert\Url] #[Groups(['course:read', 'course:write'])] + #[ORM\Column(name: 'department_url', type: 'string', length: 180, nullable: true, unique: false)] protected ?string $departmentUrl = null; - /** - * @ORM\Column(name="video_url", type="string", length=255) - */ #[Assert\Url] #[Groups(['course:read', 'course:write'])] + #[ORM\Column(name: 'video_url', type: 'string', length: 255)] protected string $videoUrl; - /** - * @ORM\Column(name="sticky", type="boolean") - */ #[Groups(['course:read', 'course:write'])] + #[ORM\Column(name: 'sticky', type: 'boolean')] protected bool $sticky; - /** - * @ORM\Column(name="disk_quota", type="bigint", nullable=true, unique=false) - */ + #[ORM\Column(name: 'disk_quota', type: 'bigint', nullable: true, unique: false)] protected ?int $diskQuota = null; - /** - * @ORM\Column(name="last_visit", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'last_visit', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastVisit; - /** - * @ORM\Column(name="last_edit", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'last_edit', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEdit; - /** - * @ORM\Column(name="creation_date", type="datetime", nullable=false, unique=false) - */ + #[ORM\Column(name: 'creation_date', type: 'datetime', nullable: false, unique: false)] protected DateTime $creationDate; - /** - * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['course:read'])] + #[ORM\Column(name: 'expiration_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $expirationDate = null; - /** - * @ORM\Column(name="subscribe", type="boolean", nullable=false, unique=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'subscribe', type: 'boolean', nullable: false, unique: false)] protected bool $subscribe; - /** - * @ORM\Column(name="unsubscribe", type="boolean", nullable=false, unique=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'unsubscribe', type: 'boolean', nullable: false, unique: false)] protected bool $unsubscribe; - /** - * @ORM\Column(name="registration_code", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'registration_code', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $registrationCode; - /** - * @ORM\Column(name="legal", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'legal', type: 'text', nullable: true, unique: false)] protected ?string $legal; - /** - * @ORM\Column(name="activate_legal", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'activate_legal', type: 'integer', nullable: true, unique: false)] protected ?int $activateLegal; - /** - * @ORM\Column(name="add_teachers_to_sessions_courses", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'add_teachers_to_sessions_courses', type: 'boolean', nullable: true)] protected ?bool $addTeachersToSessionsCourses; - /** - * @ORM\Column(name="course_type_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'course_type_id', type: 'integer', nullable: true, unique: false)] protected ?int $courseTypeId; /** @@ -435,10 +339,8 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith */ //protected $curriculumCategories; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Room") - * @ORM\JoinColumn(name="room_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Room::class)] + #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')] protected ?Room $room; public function __construct() @@ -488,7 +390,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return SessionRelCourse[]|ArrayCollection|Collection */ - public function getSessions() + public function getSessions(): array|ArrayCollection|Collection { return $this->sessions; } @@ -496,7 +398,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return CTool[]|ArrayCollection|Collection */ - public function getTools() + public function getTools(): array|ArrayCollection|Collection { return $this->tools; } @@ -531,7 +433,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return AccessUrlRelCourse[]|Collection */ - public function getUrls() + public function getUrls(): array|Collection { return $this->urls; } @@ -568,7 +470,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return Collection|CourseRelUser[] */ - public function getUsers() + public function getUsers(): Collection|array { return $this->users; } @@ -576,7 +478,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return Collection|CourseRelUser[] */ - public function getTeachers() + public function getTeachers(): Collection|array { $criteria = Criteria::create(); $criteria->where(Criteria::expr()->eq('status', CourseRelUser::TEACHER)); @@ -587,7 +489,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return Collection|CourseRelUser[] */ - public function getStudents() + public function getStudents(): Collection|array { $criteria = Criteria::create(); $criteria->where(Criteria::expr()->eq('status', CourseRelUser::STUDENT)); @@ -777,7 +679,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return CourseCategory[]|Collection */ - public function getCategories() + public function getCategories(): array|Collection { return $this->categories; } @@ -1232,7 +1134,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return SessionRelCourseRelUser[]|Collection */ - public function getSessionRelCourseRelUsers() + public function getSessionRelCourseRelUsers(): array|Collection { return $this->sessionRelCourseRelUsers; } @@ -1247,7 +1149,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return SkillRelCourse[]|Collection */ - public function getSkills() + public function getSkills(): array|Collection { return $this->skills; } @@ -1255,7 +1157,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param SkillRelCourse[]|Collection $skills */ - public function setSkills(Collection $skills): self + public function setSkills(array|Collection $skills): self { $this->skills = $skills; @@ -1265,7 +1167,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return GradebookCategory[]|Collection */ - public function getGradebookCategories() + public function getGradebookCategories(): array|Collection { return $this->gradebookCategories; } @@ -1273,7 +1175,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param GradebookCategory[]|Collection $gradebookCategories */ - public function setGradebookCategories(Collection $gradebookCategories): self + public function setGradebookCategories(array|Collection $gradebookCategories): self { $this->gradebookCategories = $gradebookCategories; @@ -1283,7 +1185,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return GradebookEvaluation[]|Collection */ - public function getGradebookEvaluations() + public function getGradebookEvaluations(): array|Collection { return $this->gradebookEvaluations; } @@ -1291,7 +1193,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param GradebookEvaluation[]|Collection $gradebookEvaluations */ - public function setGradebookEvaluations(Collection $gradebookEvaluations): self + public function setGradebookEvaluations(array|Collection $gradebookEvaluations): self { $this->gradebookEvaluations = $gradebookEvaluations; @@ -1301,7 +1203,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return GradebookLink[]|Collection */ - public function getGradebookLinks() + public function getGradebookLinks(): array|Collection { return $this->gradebookLinks; } @@ -1309,7 +1211,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param GradebookLink[]|Collection $gradebookLinks */ - public function setGradebookLinks(Collection $gradebookLinks): self + public function setGradebookLinks(array|Collection $gradebookLinks): self { $this->gradebookLinks = $gradebookLinks; @@ -1319,7 +1221,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return TrackEHotspot[]|Collection */ - public function getTrackEHotspots() + public function getTrackEHotspots(): array|Collection { return $this->trackEHotspots; } @@ -1327,7 +1229,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param TrackEHotspot[]|Collection $trackEHotspots */ - public function setTrackEHotspots(Collection $trackEHotspots): self + public function setTrackEHotspots(array|Collection $trackEHotspots): self { $this->trackEHotspots = $trackEHotspots; @@ -1337,7 +1239,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return SearchEngineRef[]|Collection */ - public function getSearchEngineRefs() + public function getSearchEngineRefs(): array|Collection { return $this->searchEngineRefs; } @@ -1345,7 +1247,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param SearchEngineRef[]|Collection $searchEngineRefs */ - public function setSearchEngineRefs(Collection $searchEngineRefs): self + public function setSearchEngineRefs(array|Collection $searchEngineRefs): self { $this->searchEngineRefs = $searchEngineRefs; @@ -1367,7 +1269,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @return Templates[]|Collection */ - public function getTemplates() + public function getTemplates(): array|Collection { return $this->templates; } @@ -1375,7 +1277,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith /** * @param Templates[]|Collection $templates */ - public function setTemplates(Collection $templates): self + public function setTemplates(array|Collection $templates): self { $this->templates = $templates; diff --git a/src/CoreBundle/Entity/CourseCategory.php b/src/CoreBundle/Entity/CourseCategory.php index 1c225da4ff..6feaf2fb64 100644 --- a/src/CoreBundle/Entity/CourseCategory.php +++ b/src/CoreBundle/Entity/CourseCategory.php @@ -27,101 +27,70 @@ use Symfony\Component\Validator\Constraints as Assert; * @ApiFilter(SearchFilter::class, properties={"name":"partial", "code":"partial"}) * @ApiFilter(PropertyFilter::class) * @ApiFilter(OrderFilter::class, properties={"name", "code"}) - * @ORM\Table( - * name="course_category", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="code", columns={"code"}) - * }, - * indexes={ - * @ORM\Index(name="parent_id", columns={"parent_id"}), - * @ORM\Index(name="tree_pos", columns={"tree_pos"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\CourseCategoryRepository") */ -class CourseCategory +#[ORM\Table(name: 'course_category')] +#[ORM\Index(name: 'parent_id', columns: ['parent_id'])] +#[ORM\Index(name: 'tree_pos', columns: ['tree_pos'])] +#[ORM\UniqueConstraint(name: 'code', columns: ['code'])] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\CourseCategoryRepository::class)] +class CourseCategory implements \Stringable { - /** - * @Groups({"course_category:read", "course:read"}) - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[Groups(['course_category:read', 'course:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseCategory", mappedBy="parent") - * * @var Collection|CourseCategory[] */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\CourseCategory::class, mappedBy: 'parent')] protected Collection $children; - /** - * @Groups({"course_category:read", "course_category:write", "course:read", "session:read"}) - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] + #[Groups(['course_category:read', 'course_category:write', 'course:read', 'session:read'])] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @Groups({"course_category:read", "course_category:write", "course:read"}) - * @ORM\Column(name="code", type="string", length=40, nullable=false) - */ #[Assert\NotBlank] + #[Groups(['course_category:read', 'course_category:write', 'course:read'])] + #[ORM\Column(name: 'code', type: 'string', length: 40, nullable: false)] protected string $code; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\CourseCategory", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\CourseCategory::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?CourseCategory $parent = null; - /** - * @ORM\Column(name="tree_pos", type="integer", nullable=true) - */ + #[ORM\Column(name: 'tree_pos', type: 'integer', nullable: true)] protected ?int $treePos = null; - /** - * @ORM\Column(name="children_count", type="smallint", nullable=true) - */ + #[ORM\Column(name: 'children_count', type: 'smallint', nullable: true)] protected ?int $childrenCount; - /** - * @ORM\Column(name="auth_course_child", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'auth_course_child', type: 'string', length: 40, nullable: true)] protected ?string $authCourseChild = null; - /** - * @ORM\Column(name="auth_cat_child", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'auth_cat_child', type: 'string', length: 40, nullable: true)] protected ?string $authCatChild = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"remove"} ) - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Asset::class, cascade: ['remove'])] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?Asset $asset = null; - /** - * @Groups({"course_category:read", "course_category:write"}) - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[Groups(['course_category:read', 'course_category:write'])] + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelCourseCategory", - * mappedBy="courseCategory", cascade={"persist"}, orphanRemoval=true - * ) - * * @var AccessUrlRelCourseCategory[]|Collection */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrlRelCourseCategory::class, mappedBy: 'courseCategory', cascade: ['persist'], orphanRemoval: true)] protected Collection $urls; /** * @var Course[]|Collection - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\Course", mappedBy="categories") */ + #[ORM\ManyToMany(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, mappedBy: 'categories')] protected Collection $courses; public function __construct() @@ -315,7 +284,7 @@ class CourseCategory /** * @return AccessUrlRelCourseCategory[]|Collection */ - public function getUrls() + public function getUrls(): array|\Doctrine\Common\Collections\Collection { return $this->urls; } @@ -323,7 +292,7 @@ class CourseCategory /** * @param AccessUrlRelCourseCategory[]|Collection $urls */ - public function setUrls($urls): self + public function setUrls(array|\Doctrine\Common\Collections\Collection $urls): self { $this->urls = $urls; diff --git a/src/CoreBundle/Entity/CourseRelClass.php b/src/CoreBundle/Entity/CourseRelClass.php index 1164ef32d8..2642d2d2c9 100644 --- a/src/CoreBundle/Entity/CourseRelClass.php +++ b/src/CoreBundle/Entity/CourseRelClass.php @@ -10,24 +10,19 @@ use Doctrine\ORM\Mapping as ORM; /** * Course subscriptions to a class. - * - * @ORM\Table(name="course_rel_class") - * @ORM\Entity */ +#[ORM\Table(name: 'course_rel_class')] +#[ORM\Entity] class CourseRelClass { - /** - * @ORM\Column(name="course_code", type="string", length=40) - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'course_code', type: 'string', length: 40)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected string $courseCode; - /** - * @ORM\Column(name="class_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'class_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected int $classId; /** diff --git a/src/CoreBundle/Entity/CourseRelUser.php b/src/CoreBundle/Entity/CourseRelUser.php index 682eaee89a..cfd22f42e9 100644 --- a/src/CoreBundle/Entity/CourseRelUser.php +++ b/src/CoreBundle/Entity/CourseRelUser.php @@ -17,15 +17,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * User subscriptions to a course. - * - * @ORM\Table( - * name="course_rel_user", - * indexes={ - * @ORM\Index(name="course_rel_user_user_id", columns={"id", "user_id"}), - * @ORM\Index(name="course_rel_user_c_id_user_id", columns={"id", "c_id", "user_id"}) - * } - * ) - * @ORM\Entity */ #[ApiResource( attributes: [ @@ -59,8 +50,12 @@ use Symfony\Component\Validator\Constraints as Assert; 'user' => 'exact', 'user.username' => 'partial', ])] +#[ORM\Table(name: 'course_rel_user')] +#[ORM\Index(name: 'course_rel_user_user_id', columns: ['id', 'user_id'])] +#[ORM\Index(name: 'course_rel_user_c_id_user_id', columns: ['id', 'c_id', 'user_id'])] +#[ORM\Entity] -class CourseRelUser +class CourseRelUser implements \Stringable { use UserTrait; @@ -69,69 +64,45 @@ class CourseRelUser //public const DRH = 4; public const STUDENT = 5; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="courses", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ #[MaxDepth(1)] #[Groups(['course:read', 'user:read', 'course_rel_user:read'])] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'courses', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="users", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ #[Groups(['user:read'])] + #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'users', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected Course $course; - /** - * @ORM\Column(name="relation_type", type="integer") - */ #[Groups(['course:read', 'user:read'])] + #[ORM\Column(name: 'relation_type', type: 'integer')] protected int $relationType; - /** - * @ORM\Column(name="status", type="integer") - */ #[Groups(['user:read'])] + #[ORM\Column(name: 'status', type: 'integer')] protected int $status; - /** - * @ORM\Column(name="is_tutor", type="boolean", nullable=true, unique=false) - */ + #[ORM\Column(name: 'is_tutor', type: 'boolean', nullable: true, unique: false)] protected ?bool $tutor; - /** - * @ORM\Column(name="sort", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sort', type: 'integer', nullable: true, unique: false)] protected ?int $sort; - /** - * @ORM\Column(name="user_course_cat", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'user_course_cat', type: 'integer', nullable: true, unique: false)] protected ?int $userCourseCat; - /** - * @ORM\Column(name="legal_agreement", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'legal_agreement', type: 'integer', nullable: true, unique: false)] protected ?int $legalAgreement = null; - /** - * @Assert\Range( - * min = 0, - * max = 100, - * notInRangeMessage = "Progress from {{ min }} to {{ max }} only", - * ) - * @ORM\Column(name="progress", type="integer") - */ #[Groups(['course:read', 'user:read'])] + #[Assert\Range(min: 0, max: 100, notInRangeMessage: 'Progress from {{ min }} to {{ max }} only')] + #[ORM\Column(name: 'progress', type: 'integer')] protected int $progress; public function __construct() diff --git a/src/CoreBundle/Entity/CourseRelUserCatalogue.php b/src/CoreBundle/Entity/CourseRelUserCatalogue.php index 522d46d2c9..9be0a05f7b 100644 --- a/src/CoreBundle/Entity/CourseRelUserCatalogue.php +++ b/src/CoreBundle/Entity/CourseRelUserCatalogue.php @@ -9,43 +9,28 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="course_rel_user_catalogue", - * indexes={ - * @ORM\Index(name="course_rel_user_catalogue_user_id", columns={"user_id"}), - * @ORM\Index(name="course_rel_user_catalogue_c_id", columns={"c_id"}) - * } - * ) - * @ORM\Entity - * @ORM\Table(name="course_rel_user_catalogue") - */ -class CourseRelUserCatalogue +#[ORM\Table(name: 'course_rel_user_catalogue')] +#[ORM\Index(name: 'course_rel_user_catalogue_user_id', columns: ['user_id'])] +#[ORM\Index(name: 'course_rel_user_catalogue_c_id', columns: ['c_id'])] +#[ORM\Entity] +class CourseRelUserCatalogue implements \Stringable { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="courses", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'courses', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected ?User $user = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="users", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'users', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected ?Course $course = null; - /** - * @ORM\Column(name="visible", type="integer") - */ + #[ORM\Column(name: 'visible', type: 'integer')] protected int $visible; public function __construct() diff --git a/src/CoreBundle/Entity/CourseRequest.php b/src/CoreBundle/Entity/CourseRequest.php index 8a586fc882..98e8d7b66a 100644 --- a/src/CoreBundle/Entity/CourseRequest.php +++ b/src/CoreBundle/Entity/CourseRequest.php @@ -11,93 +11,60 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="course_request", uniqueConstraints={ - * @ORM\UniqueConstraint(name="code", columns={"code"}) - * }) - * @ORM\Entity - */ +#[ORM\Table(name: 'course_request')] +#[ORM\UniqueConstraint(name: 'code', columns: ['code'])] +#[ORM\Entity] class CourseRequest { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: User::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\Column(name="code", type="string", length=40, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'code', type: 'string', length: 40, nullable: false)] protected string $code; - /** - * @ORM\Column(name="course_language", type="string", length=20, nullable=false) - */ + #[ORM\Column(name: 'course_language', type: 'string', length: 20, nullable: false)] protected string $courseLanguage; - /** - * @ORM\Column(name="title", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="category_code", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'category_code', type: 'string', length: 40, nullable: true)] protected ?string $categoryCode = null; - /** - * @ORM\Column(name="tutor_name", type="string", length=200, nullable=true) - */ + #[ORM\Column(name: 'tutor_name', type: 'string', length: 200, nullable: true)] protected ?string $tutorName = null; - /** - * @ORM\Column(name="visual_code", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'visual_code', type: 'string', length: 40, nullable: true)] protected ?string $visualCode = null; - /** - * @ORM\Column(name="request_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'request_date', type: 'datetime', nullable: false)] protected DateTime $requestDate; - /** - * @ORM\Column(name="objetives", type="text", nullable=true) - */ + #[ORM\Column(name: 'objetives', type: 'text', nullable: true)] protected ?string $objetives = null; - /** - * @ORM\Column(name="target_audience", type="text", nullable=true) - */ + #[ORM\Column(name: 'target_audience', type: 'text', nullable: true)] protected ?string $targetAudience = null; - /** - * @ORM\Column(name="status", type="integer", nullable=false) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: false)] protected int $status; - /** - * @ORM\Column(name="info", type="integer", nullable=false) - */ + #[ORM\Column(name: 'info', type: 'integer', nullable: false)] protected int $info; - /** - * @ORM\Column(name="exemplary_content", type="integer", nullable=false) - */ + #[ORM\Column(name: 'exemplary_content', type: 'integer', nullable: false)] protected int $exemplaryContent; public function __construct() diff --git a/src/CoreBundle/Entity/CourseType.php b/src/CoreBundle/Entity/CourseType.php index f4185afe2e..f0b53ad9f4 100644 --- a/src/CoreBundle/Entity/CourseType.php +++ b/src/CoreBundle/Entity/CourseType.php @@ -8,37 +8,25 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="course_type") - * @ORM\Entity - */ +#[ORM\Table(name: 'course_type')] +#[ORM\Entity] class CourseType { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=50, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 50, nullable: false)] protected string $name; - /** - * @ORM\Column(name="translation_var", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'translation_var', type: 'string', length: 40, nullable: true)] protected ?string $translationVar = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="props", type="text", nullable=true) - */ + #[ORM\Column(name: 'props', type: 'text', nullable: true)] protected ?string $props = null; public function setName(string $name): self diff --git a/src/CoreBundle/Entity/ExtraField.php b/src/CoreBundle/Entity/ExtraField.php index c177d4424c..628f32e0dd 100644 --- a/src/CoreBundle/Entity/ExtraField.php +++ b/src/CoreBundle/Entity/ExtraField.php @@ -17,12 +17,6 @@ use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * @ORM\Table(name="extra_field") - * - * @ORM\MappedSuperclass - */ #[ApiResource( collectionOperations:[ 'get' => [ @@ -51,6 +45,9 @@ use Symfony\Component\Validator\Constraints as Assert; ], )] #[ApiFilter(SearchFilter::class, properties: ['variable'])] +#[ORM\Table(name: 'extra_field')] +#[ORM\Entity] +#[ORM\MappedSuperclass] class ExtraField { public const USER_FIELD_TYPE = 1; @@ -74,106 +71,74 @@ class ExtraField public const PORTFOLIO_TYPE = 19; public const LP_VIEW_TYPE = 20; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['extra_field:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="item_type", type="integer") - */ #[Groups(['extra_field:read', 'extra_field:write'])] + #[ORM\Column(name: 'item_type', type: 'integer')] protected int $itemType; - /** - * @ORM\Column(name="value_type", type="integer") - */ #[Groups(['extra_field:read', 'extra_field:write'])] + #[ORM\Column(name: 'value_type', type: 'integer')] protected int $valueType; - /** - * @ORM\Column(name="variable", type="string", length=255) - */ #[Assert\NotBlank] #[Groups(['extra_field:read', 'extra_field:write'])] + #[ORM\Column(name: 'variable', type: 'string', length: 255)] protected string $variable; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ #[Groups(['extra_field:read', 'extra_field:write'])] + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @Gedmo\Translatable - * @ORM\Column(name="display_text", type="string", length=255, nullable=true, unique=false) - */ #[Assert\NotBlank] #[Groups(['extra_field:read', 'extra_field:write'])] + #[Gedmo\Translatable] + #[ORM\Column(name: 'display_text', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $displayText = null; - /** - * @Gedmo\Locale - */ + #[Gedmo\Locale] protected ?string $locale = null; - /** - * @ORM\Column(name="helper_text", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'helper_text', type: 'text', nullable: true, unique: false)] protected ?string $helperText = null; - /** - * @ORM\Column(name="default_value", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'default_value', type: 'text', nullable: true, unique: false)] protected ?string $defaultValue = null; - /** - * @ORM\Column(name="field_order", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'field_order', type: 'integer', nullable: true, unique: false)] protected ?int $fieldOrder = null; - /** - * @ORM\Column(name="visible_to_self", type="boolean", nullable=true, unique=false) - */ + #[ORM\Column(name: 'visible_to_self', type: 'boolean', nullable: true, unique: false)] protected ?bool $visibleToSelf; - /** - * @ORM\Column(name="visible_to_others", type="boolean", nullable=true, unique=false) - */ + #[ORM\Column(name: 'visible_to_others', type: 'boolean', nullable: true, unique: false)] protected ?bool $visibleToOthers; - /** - * @ORM\Column(name="changeable", type="boolean", nullable=true, unique=false) - */ + #[ORM\Column(name: 'changeable', type: 'boolean', nullable: true, unique: false)] protected ?bool $changeable = null; - /** - * @ORM\Column(name="filter", type="boolean", nullable=true, unique=false) - */ + #[ORM\Column(name: 'filter', type: 'boolean', nullable: true, unique: false)] protected ?bool $filter = null; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldOptions", mappedBy="field") - * * @var Collection */ #[Groups(['extra_field:read'])] + #[ORM\OneToMany(targetEntity: ExtraFieldOptions::class, mappedBy: 'field')] protected Collection $options; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Tag", mappedBy="field") - * * @var Tag[]|Collection */ + #[ORM\OneToMany(targetEntity: Tag::class, mappedBy: 'field')] protected Collection $tags; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime") - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime')] protected DateTime $createdAt; public function __construct() @@ -362,7 +327,7 @@ class ExtraField /** * @return Tag[]|Collection */ - public function getTags() + public function getTags(): array|\Doctrine\Common\Collections\Collection { return $this->tags; } @@ -380,22 +345,15 @@ class ExtraField return false; } - return $this->tags->exists(function ($key, Tag $tag) use ($tagName) { - return $tagName === $tag->getTag(); - }); + return $this->tags->exists(fn ($key, Tag $tag) => $tagName === $tag->getTag()); } public function getTypeToString(): string { - switch ($this->getItemType()) { - case \ExtraField::FIELD_TYPE_RADIO: - case \ExtraField::FIELD_TYPE_SELECT: - return 'choice'; - case \ExtraField::FIELD_TYPE_TEXT: - case \ExtraField::FIELD_TYPE_TEXTAREA: - default: - return 'text'; - } + return match ($this->getItemType()) { + \ExtraField::FIELD_TYPE_RADIO, \ExtraField::FIELD_TYPE_SELECT => 'choice', + default => 'text', + }; } public function getHelperText(): string diff --git a/src/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php b/src/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php index 51d5cf1076..486b50ed51 100644 --- a/src/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php +++ b/src/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php @@ -8,45 +8,29 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="extra_field_option_rel_field_option", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="idx", columns={"field_id", "role_id", "field_option_id", "related_field_option_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'extra_field_option_rel_field_option')] +#[ORM\UniqueConstraint(name: 'idx', columns: ['field_id', 'role_id', 'field_option_id', 'related_field_option_id'])] +#[ORM\Entity] class ExtraFieldOptionRelFieldOption { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldOptions") - * @ORM\JoinColumn(name="field_option_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraFieldOptions::class)] + #[ORM\JoinColumn(name: 'field_option_id', referencedColumnName: 'id')] protected ExtraFieldOptions $extraFieldOption; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldOptions") - * @ORM\JoinColumn(name="related_field_option_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraFieldOptions::class)] + #[ORM\JoinColumn(name: 'related_field_option_id', referencedColumnName: 'id')] protected ExtraFieldOptions $relatedFieldOption; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraField::class)] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id')] protected ExtraField $field; - /** - * @ORM\Column(name="role_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'role_id', type: 'integer', nullable: true, unique: false)] protected ?int $roleId = null; /** diff --git a/src/CoreBundle/Entity/ExtraFieldOptions.php b/src/CoreBundle/Entity/ExtraFieldOptions.php index 69ef860e7b..1816602a4f 100644 --- a/src/CoreBundle/Entity/ExtraFieldOptions.php +++ b/src/CoreBundle/Entity/ExtraFieldOptions.php @@ -10,57 +10,38 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ExtraFieldOptionsRepository") - * @ORM\Table(name="extra_field_options") - * - * @ORM\MappedSuperclass - */ +#[ORM\Table(name: 'extra_field_options')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\ExtraFieldOptionsRepository::class)] +#[ORM\MappedSuperclass] class ExtraFieldOptions { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField", inversedBy="options") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraField::class, inversedBy: 'options')] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id')] protected ExtraField $field; - /** - * @ORM\Column(name="option_value", type="text", nullable=true) - */ + #[ORM\Column(name: 'option_value', type: 'text', nullable: true)] protected ?string $value = null; - /** - * @Gedmo\Translatable - * @ORM\Column(name="display_text", type="string", length=255, nullable=true) - */ + #[Gedmo\Translatable] + #[ORM\Column(name: 'display_text', type: 'string', length: 255, nullable: true)] protected ?string $displayText = null; - /** - * @Gedmo\Locale - */ + #[Gedmo\Locale] protected ?string $locale = null; - /** - * @ORM\Column(name="priority", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'priority', type: 'string', length: 255, nullable: true)] protected ?string $priority = null; - /** - * @ORM\Column(name="priority_message", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'priority_message', type: 'string', length: 255, nullable: true)] protected ?string $priorityMessage = null; - /** - * @ORM\Column(name="option_order", type="integer", nullable=true) - */ + #[ORM\Column(name: 'option_order', type: 'integer', nullable: true)] protected ?int $optionOrder = null; /** diff --git a/src/CoreBundle/Entity/ExtraFieldRelTag.php b/src/CoreBundle/Entity/ExtraFieldRelTag.php index 998f16283a..7deb951a50 100644 --- a/src/CoreBundle/Entity/ExtraFieldRelTag.php +++ b/src/CoreBundle/Entity/ExtraFieldRelTag.php @@ -6,44 +6,31 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\Entity; +use Chamilo\CoreBundle\Repository\ExtraFieldRelTagRepository; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="extra_field_rel_tag", - * indexes={ - * @ORM\Index(name="field", columns={"field_id"}), - * @ORM\Index(name="item", columns={"item_id"}), - * @ORM\Index(name="tag", columns={"tag_id"}), - * @ORM\Index(name="field_item_tag", columns={"field_id", "item_id", "tag_id"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ExtraFieldRelTagRepository") - */ +#[ORM\Table(name: 'extra_field_rel_tag')] +#[ORM\Index(name: 'field', columns: ['field_id'])] +#[ORM\Index(name: 'item', columns: ['item_id'])] +#[ORM\Index(name: 'tag', columns: ['tag_id'])] +#[ORM\Index(name: 'field_item_tag', columns: ['field_id', 'item_id', 'tag_id'])] +#[ORM\Entity(repositoryClass: ExtraFieldRelTagRepository::class)] class ExtraFieldRelTag { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: ExtraField::class)] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ExtraField $field; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tag", inversedBy="extraFieldRelTags") - * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Tag::class, inversedBy: 'extraFieldRelTags')] + #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Tag $tag; - /** - * @ORM\Column(name="item_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'item_id', type: 'integer', nullable: false)] protected int $itemId; public function setItemId(int $itemId): self diff --git a/src/CoreBundle/Entity/ExtraFieldSavedSearch.php b/src/CoreBundle/Entity/ExtraFieldSavedSearch.php index b8b4c15650..67cefab922 100644 --- a/src/CoreBundle/Entity/ExtraFieldSavedSearch.php +++ b/src/CoreBundle/Entity/ExtraFieldSavedSearch.php @@ -10,37 +10,27 @@ use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Entity - * @ORM\Table(name="extra_field_saved_search") - */ +#[ORM\Table(name: 'extra_field_saved_search')] +#[ORM\Entity] class ExtraFieldSavedSearch { use TimestampableEntity; use UserTrait; - /** - * @ORM\Column(name="id", type="integer", nullable=false) - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraField::class)] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id')] protected ExtraField $field; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\Column(name="value", type="array", nullable=true, unique=false) - */ + #[ORM\Column(name: 'value', type: 'array', nullable: true, unique: false)] protected ?array $value; public function __construct() diff --git a/src/CoreBundle/Entity/ExtraFieldValues.php b/src/CoreBundle/Entity/ExtraFieldValues.php index 8854de87e5..9827fce9a8 100644 --- a/src/CoreBundle/Entity/ExtraFieldValues.php +++ b/src/CoreBundle/Entity/ExtraFieldValues.php @@ -9,22 +9,12 @@ namespace Chamilo\CoreBundle\Entity; use ApiPlatform\Core\Annotation\ApiFilter; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; +use Chamilo\CoreBundle\Repository\ExtraFieldValuesRepository; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="extra_field_values", - * indexes={ - * @ORM\Index(name="idx_efv_fiii", columns={"field_id", "item_id"}), - * @ORM\Index(name="idx_efv_item", columns={"item_id"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ExtraFieldValuesRepository") - * @ORM\MappedSuperclass - */ #[ApiResource( collectionOperations:[ 'get' => [ @@ -53,51 +43,45 @@ use Symfony\Component\Validator\Constraints as Assert; ], )] #[ApiFilter(SearchFilter::class, properties: ['field' => 'exact', 'value' => 'exact'])] +#[ORM\Table(name: 'extra_field_values')] +#[ORM\Index(name: 'idx_efv_fiii', columns: ['field_id', 'item_id'])] +#[ORM\Index(name: 'idx_efv_item', columns: ['item_id'])] +#[ORM\Entity(repositoryClass: ExtraFieldValuesRepository::class)] +#[ORM\MappedSuperclass] class ExtraFieldValues { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups(['extra_field_values:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="field_value", type="text", nullable=true, unique=false) - */ #[Groups(['extra_field_values:read', 'extra_field_values:write'])] + #[ORM\Column(name: 'field_value', type: 'text', nullable: true, unique: false)] protected ?string $fieldValue = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id") - */ #[Assert\NotBlank] #[Groups(['extra_field_values:read', 'extra_field_values:write'])] + #[ORM\ManyToOne(targetEntity: ExtraField::class)] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id')] protected ExtraField $field; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset") - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Asset::class)] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Asset $asset = null; /** * Item id can be: userId, courseId, sessionId, etc. - * - * @ORM\Column(name="item_id", type="integer") */ #[Assert\NotBlank] #[Groups(['extra_field_values:read', 'extra_field_values:write'])] + #[ORM\Column(name: 'item_id', type: 'integer')] protected int $itemId; - /** - * @ORM\Column(name="comment", type="text", nullable=true, unique=false) - */ #[Groups(['extra_field_values:read', 'extra_field_values:write'])] + #[ORM\Column(name: 'comment', type: 'text', nullable: true, unique: false)] protected ?string $comment; public function __construct() diff --git a/src/CoreBundle/Entity/GradeComponents.php b/src/CoreBundle/Entity/GradeComponents.php index 0ef0dd6190..4f16f83f80 100644 --- a/src/CoreBundle/Entity/GradeComponents.php +++ b/src/CoreBundle/Entity/GradeComponents.php @@ -10,38 +10,27 @@ use Doctrine\ORM\Mapping as ORM; /** * GradeComponents. - * - * @ORM\Table(name="grade_components") - * @ORM\Entity */ +#[ORM\Table(name: 'grade_components')] +#[ORM\Entity] class GradeComponents { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="percentage", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'percentage', type: 'string', length: 255, nullable: false)] protected string $percentage; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="acronym", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'acronym', type: 'string', length: 255, nullable: false)] protected string $acronym; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradeModel") - * @ORM\JoinColumn(name="grade_model_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradeModel::class)] + #[ORM\JoinColumn(name: 'grade_model_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradeModel $gradeModel; public function setPercentage(string $percentage): self diff --git a/src/CoreBundle/Entity/GradeModel.php b/src/CoreBundle/Entity/GradeModel.php index e6b82d4164..2052410378 100644 --- a/src/CoreBundle/Entity/GradeModel.php +++ b/src/CoreBundle/Entity/GradeModel.php @@ -10,42 +10,29 @@ use Doctrine\ORM\Mapping as ORM; /** * GradeModel. - * - * @ORM\Table(name="grade_model") - * @ORM\Entity */ +#[ORM\Table(name: 'grade_model')] +#[ORM\Entity] class GradeModel { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="default_lowest_eval_exclude", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'default_lowest_eval_exclude', type: 'boolean', nullable: true)] protected ?bool $defaultLowestEvalExclude = null; - /** - * @ORM\Column(name="default_external_eval", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'default_external_eval', type: 'boolean', nullable: true)] protected ?bool $defaultExternalEval = null; - /** - * @ORM\Column(name="default_external_eval_prefix", type="string", length=140, nullable=true) - */ + #[ORM\Column(name: 'default_external_eval_prefix', type: 'string', length: 140, nullable: true)] protected ?string $defaultExternalEvalPrefix = null; public function setName(string $name): self diff --git a/src/CoreBundle/Entity/GradebookCategory.php b/src/CoreBundle/Entity/GradebookCategory.php index 595da2ef95..58f2053f03 100644 --- a/src/CoreBundle/Entity/GradebookCategory.php +++ b/src/CoreBundle/Entity/GradebookCategory.php @@ -13,162 +13,110 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="gradebook_category", - * indexes={ - * })) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_category')] +#[ORM\Entity] class GradebookCategory { use UserTrait; use CourseTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookCategories") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookCategories')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="gradebookCategories") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'gradebookCategories')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", inversedBy="subCategories") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, inversedBy: 'subCategories')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?GradebookCategory $parent = null; /** * @var GradebookCategory[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="parent") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, mappedBy: 'parent')] protected Collection $subCategories; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Session $session = null; /** * @var SkillRelGradebook[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelGradebook", mappedBy="gradeBookCategory") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\SkillRelGradebook::class, mappedBy: 'gradeBookCategory')] protected Collection $skills; /** * @var Collection|GradebookEvaluation[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", mappedBy="category", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\GradebookEvaluation::class, mappedBy: 'category', cascade: ['persist', 'remove'])] protected Collection $evaluations; /** * @var Collection|GradebookLink[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", mappedBy="category", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\GradebookLink::class, mappedBy: 'category', cascade: ['persist', 'remove'])] protected Collection $links; /** * @var Collection|GradebookComment[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookComment", mappedBy="gradeBook") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\GradebookComment::class, mappedBy: 'gradeBook')] protected Collection $comments; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradeModel") - * @ORM\JoinColumn(name="grade_model_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradeModel::class)] + #[ORM\JoinColumn(name: 'grade_model_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?GradeModel $gradeModel = null; - /** - * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'weight', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $weight; - /** - * @ORM\Column(name="visible", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'visible', type: 'boolean', nullable: false)] protected bool $visible; - /** - * @ORM\Column(name="certif_min_score", type="integer", nullable=true) - */ + #[ORM\Column(name: 'certif_min_score', type: 'integer', nullable: true)] protected ?int $certifMinScore = null; - /** - * @ORM\Column(name="document_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'document_id', type: 'integer', nullable: true)] protected ?int $documentId = null; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected ?int $locked; - /** - * @ORM\Column(name="default_lowest_eval_exclude", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'default_lowest_eval_exclude', type: 'boolean', nullable: true)] protected ?bool $defaultLowestEvalExclude = null; - /** - * @ORM\Column(name="generate_certificates", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'generate_certificates', type: 'boolean', nullable: false)] protected bool $generateCertificates; - /** - * @ORM\Column( - * name="is_requirement", - * type="boolean", - * nullable=false, - * options={"default":0 } - * ) - */ + #[ORM\Column(name: 'is_requirement', type: 'boolean', nullable: false, options: ['default' => 0])] protected bool $isRequirement; - /** - * @ORM\Column(name="depends", type="text", nullable=true) - */ + #[ORM\Column(name: 'depends', type: 'text', nullable: true)] protected ?string $depends = null; - /** - * @ORM\Column(name="minimum_to_validate", type="integer", nullable=true) - */ + #[ORM\Column(name: 'minimum_to_validate', type: 'integer', nullable: true)] protected ?int $minimumToValidate = null; - /** - * @ORM\Column(name="gradebooks_to_validate_in_dependence", type="integer", nullable=true) - */ + #[ORM\Column(name: 'gradebooks_to_validate_in_dependence', type: 'integer', nullable: true)] protected ?int $gradeBooksToValidateInDependence = null; public function __construct() @@ -411,7 +359,7 @@ class GradebookCategory /** * @return GradebookComment[]|Collection */ - public function getComments() + public function getComments(): array|\Doctrine\Common\Collections\Collection { return $this->comments; } @@ -419,7 +367,7 @@ class GradebookCategory /** * @param GradebookComment[]|Collection $comments */ - public function setComments(Collection $comments): self + public function setComments(array|\Doctrine\Common\Collections\Collection $comments): self { $this->comments = $comments; @@ -453,7 +401,7 @@ class GradebookCategory /** * @return GradebookEvaluation[]|Collection */ - public function getEvaluations() + public function getEvaluations(): array|\Doctrine\Common\Collections\Collection { return $this->evaluations; } @@ -461,7 +409,7 @@ class GradebookCategory /** * @param GradebookEvaluation[]|Collection $evaluations */ - public function setEvaluations(Collection $evaluations): self + public function setEvaluations(array|\Doctrine\Common\Collections\Collection $evaluations): self { $this->evaluations = $evaluations; @@ -471,7 +419,7 @@ class GradebookCategory /** * @return GradebookLink[]|Collection */ - public function getLinks() + public function getLinks(): array|\Doctrine\Common\Collections\Collection { return $this->links; } @@ -479,7 +427,7 @@ class GradebookCategory /** * @param GradebookLink[]|Collection $links */ - public function setLinks(Collection $links): self + public function setLinks(array|\Doctrine\Common\Collections\Collection $links): self { $this->links = $links; @@ -489,7 +437,7 @@ class GradebookCategory /** * @return GradebookCategory[]|Collection */ - public function getSubCategories() + public function getSubCategories(): array|\Doctrine\Common\Collections\Collection { return $this->subCategories; } @@ -533,7 +481,7 @@ class GradebookCategory /** * @return SkillRelGradebook[]|Collection */ - public function getSkills() + public function getSkills(): array|\Doctrine\Common\Collections\Collection { return $this->skills; } @@ -541,7 +489,7 @@ class GradebookCategory /** * @param SkillRelGradebook[]|Collection $skills */ - public function setSkills(Collection $skills): self + public function setSkills(array|\Doctrine\Common\Collections\Collection $skills): self { $this->skills = $skills; diff --git a/src/CoreBundle/Entity/GradebookCertificate.php b/src/CoreBundle/Entity/GradebookCertificate.php index 2cda252d1b..05347964fc 100644 --- a/src/CoreBundle/Entity/GradebookCertificate.php +++ b/src/CoreBundle/Entity/GradebookCertificate.php @@ -11,57 +11,37 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table( - * name="gradebook_certificate", - * indexes={ - * @ORM\Index(name="idx_gradebook_certificate_user_id", columns={"user_id"}), - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_certificate')] +#[ORM\Index(name: 'idx_gradebook_certificate_user_id', columns: ['user_id'])] +#[ORM\Entity] class GradebookCertificate { use UserTrait; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory") - * @ORM\JoinColumn(name="cat_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class)] + #[ORM\JoinColumn(name: 'cat_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookCertificates") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookCertificates')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="score_certificate", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score_certificate', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $scoreCertificate; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; - /** - * @ORM\Column(name="path_certificate", type="text", nullable=true) - */ + #[ORM\Column(name: 'path_certificate', type: 'text', nullable: true)] protected ?string $pathCertificate = null; - /** - * @ORM\Column(name="downloaded_at", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'downloaded_at', type: 'datetime', nullable: true)] protected ?DateTime $downloadedAt = null; public function setScoreCertificate(float $scoreCertificate): self diff --git a/src/CoreBundle/Entity/GradebookComment.php b/src/CoreBundle/Entity/GradebookComment.php index 7c3c525f14..735905f96d 100644 --- a/src/CoreBundle/Entity/GradebookComment.php +++ b/src/CoreBundle/Entity/GradebookComment.php @@ -10,40 +10,27 @@ use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table( - * name="gradebook_comment", - * indexes={} - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_comment')] +#[ORM\Entity] class GradebookComment { use UserTrait; use TimestampableEntity; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookComments") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookComments')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", inversedBy="comments") - * @ORM\JoinColumn(name="gradebook_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, inversedBy: 'comments')] + #[ORM\JoinColumn(name: 'gradebook_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $gradeBook; - /** - * @ORM\Column(name="comment", type="text") - */ + #[ORM\Column(name: 'comment', type: 'text')] protected ?string $comment; public function __construct() diff --git a/src/CoreBundle/Entity/GradebookEvaluation.php b/src/CoreBundle/Entity/GradebookEvaluation.php index 234a0dfaad..2b0037bc7a 100644 --- a/src/CoreBundle/Entity/GradebookEvaluation.php +++ b/src/CoreBundle/Entity/GradebookEvaluation.php @@ -13,108 +13,72 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="gradebook_evaluation", - * indexes={ - * @ORM\Index(name="idx_ge_cat", columns={"category_id"}), - * }) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_evaluation')] +#[ORM\Index(name: 'idx_ge_cat', columns: ['category_id'])] +#[ORM\Entity] class GradebookEvaluation { use CourseTrait; use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookEvaluations") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookEvaluations')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="gradebookEvaluations") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'gradebookEvaluations')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", inversedBy="evaluations") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, inversedBy: 'evaluations')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $category; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; - /** - * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'weight', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $weight; - /** - * @ORM\Column(name="max", type="float", precision=10, scale=0, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'max', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $max; - /** - * @ORM\Column(name="visible", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'visible', type: 'integer', nullable: false)] protected int $visible; - /** - * @ORM\Column(name="type", type="string", length=40, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'type', type: 'string', length: 40, nullable: false)] protected string $type; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; - /** - * @ORM\Column(name="best_score", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'best_score', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $bestScore = null; - /** - * @ORM\Column(name="average_score", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'average_score', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $averageScore = null; - /** - * @ORM\Column(name="score_weight", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'score_weight', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $scoreWeight = null; - /** - * @ORM\Column(name="user_score_list", type="array", nullable=true) - */ + #[ORM\Column(name: 'user_score_list', type: 'array', nullable: true)] protected ?array $userScoreList = null; public function __construct() diff --git a/src/CoreBundle/Entity/GradebookLink.php b/src/CoreBundle/Entity/GradebookLink.php index 5a37b68fbe..e705540e11 100644 --- a/src/CoreBundle/Entity/GradebookLink.php +++ b/src/CoreBundle/Entity/GradebookLink.php @@ -13,97 +13,64 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="gradebook_link", - * indexes={ - * @ORM\Index(name="idx_gl_cat", columns={"category_id"}), - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_link')] +#[ORM\Index(name: 'idx_gl_cat', columns: ['category_id'])] +#[ORM\Entity] class GradebookLink { use CourseTrait; use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="type", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'type', type: 'integer', nullable: false)] protected int $type; - /** - * @ORM\Column(name="ref_id", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'ref_id', type: 'integer', nullable: false)] protected int $refId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookLinks") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookLinks')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="gradebookLinks") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'gradebookLinks')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", inversedBy="links") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, inversedBy: 'links')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $category; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; - /** - * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'weight', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $weight; - /** - * @ORM\Column(name="visible", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'visible', type: 'integer', nullable: false)] protected int $visible; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; - /** - * @ORM\Column(name="best_score", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'best_score', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $bestScore = null; - /** - * @ORM\Column(name="average_score", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'average_score', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $averageScore = null; - /** - * @ORM\Column(name="score_weight", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'score_weight', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $scoreWeight = null; - /** - * @ORM\Column(name="user_score_list", type="array", nullable=true) - */ + #[ORM\Column(name: 'user_score_list', type: 'array', nullable: true)] protected ?array $userScoreList = null; public function __construct() diff --git a/src/CoreBundle/Entity/GradebookLinkevalLog.php b/src/CoreBundle/Entity/GradebookLinkevalLog.php index 32a440c977..77ded266eb 100644 --- a/src/CoreBundle/Entity/GradebookLinkevalLog.php +++ b/src/CoreBundle/Entity/GradebookLinkevalLog.php @@ -11,61 +11,41 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table(name="gradebook_linkeval_log") - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_linkeval_log')] +#[ORM\Entity] class GradebookLinkevalLog { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="id_linkeval_log", type="integer", nullable=false) - */ + #[ORM\Column(name: 'id_linkeval_log', type: 'integer', nullable: false)] protected int $idLinkevalLog; - /** - * @ORM\Column(name="name", type="text") - */ + #[ORM\Column(name: 'name', type: 'text')] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="weight", type="smallint", nullable=true) - */ + #[ORM\Column(name: 'weight', type: 'smallint', nullable: true)] protected ?int $weight = null; - /** - * @ORM\Column(name="visible", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'visible', type: 'boolean', nullable: true)] protected ?bool $visible = null; - /** - * @ORM\Column(name="type", type="string", length=20, nullable=false) - */ + #[ORM\Column(name: 'type', type: 'string', length: 20, nullable: false)] protected string $type; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookLinkEvalLogs") - * @ORM\JoinColumn(name="user_id_log", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'gradeBookLinkEvalLogs')] + #[ORM\JoinColumn(name: 'user_id_log', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; /** diff --git a/src/CoreBundle/Entity/GradebookResult.php b/src/CoreBundle/Entity/GradebookResult.php index c5e707a18b..7ba6656f18 100644 --- a/src/CoreBundle/Entity/GradebookResult.php +++ b/src/CoreBundle/Entity/GradebookResult.php @@ -11,46 +11,31 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table(name="gradebook_result", - * indexes={ - * @ORM\Index(name="idx_gb_uid_eid", columns={"user_id", "evaluation_id"}), - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_result')] +#[ORM\Index(name: 'idx_gb_uid_eid', columns: ['user_id', 'evaluation_id'])] +#[ORM\Entity] class GradebookResult { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation") - * @ORM\JoinColumn(name="evaluation_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookEvaluation::class)] + #[ORM\JoinColumn(name: 'evaluation_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookEvaluation $evaluation; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookResults") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookResults')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=true) - */ + #[ORM\Column(name: 'score', type: 'float', precision: 10, scale: 0, nullable: true)] protected ?float $score = null; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; public function setCreatedAt(DateTime $createdAt): self diff --git a/src/CoreBundle/Entity/GradebookResultAttempt.php b/src/CoreBundle/Entity/GradebookResultAttempt.php index 7d10c2097c..8da7436090 100644 --- a/src/CoreBundle/Entity/GradebookResultAttempt.php +++ b/src/CoreBundle/Entity/GradebookResultAttempt.php @@ -9,35 +9,25 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="gradebook_result_attempt") - * @ORM\Entity - */ +#[ORM\Table(name: 'gradebook_result_attempt')] +#[ORM\Entity] class GradebookResultAttempt { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="score", type="float", nullable=true) - */ + #[ORM\Column(name: 'score', type: 'float', nullable: true)] protected ?float $score = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookResult") - * @ORM\JoinColumn(name="result_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookResult::class)] + #[ORM\JoinColumn(name: 'result_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookResult $result; public function getId(): int diff --git a/src/CoreBundle/Entity/GradebookResultLog.php b/src/CoreBundle/Entity/GradebookResultLog.php index de23994d38..126b08726b 100644 --- a/src/CoreBundle/Entity/GradebookResultLog.php +++ b/src/CoreBundle/Entity/GradebookResultLog.php @@ -13,48 +13,35 @@ use Gedmo\Mapping\Annotation as Gedmo; /** * GradebookResultLog. - * - * @ORM\Table(name="gradebook_result_log") - * @ORM\Entity */ +#[ORM\Table(name: 'gradebook_result_log')] +#[ORM\Entity] class GradebookResultLog { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookResult") - * @ORM\JoinColumn(name="result_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: GradebookResult::class)] + #[ORM\JoinColumn(name: 'result_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookResult $result; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation") - * @ORM\JoinColumn(name="evaluation_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: GradebookEvaluation::class)] + #[ORM\JoinColumn(name: 'evaluation_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookEvaluation $evaluation; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; - /** - * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=true) - */ + #[ORM\Column(name: 'score', type: 'float', precision: 10, scale: 0, nullable: true)] protected ?float $score = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookResultLogs") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'gradeBookResultLogs')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; /** diff --git a/src/CoreBundle/Entity/GradebookScoreDisplay.php b/src/CoreBundle/Entity/GradebookScoreDisplay.php index 70382f6781..856c23cd0c 100644 --- a/src/CoreBundle/Entity/GradebookScoreDisplay.php +++ b/src/CoreBundle/Entity/GradebookScoreDisplay.php @@ -10,40 +10,28 @@ use Doctrine\ORM\Mapping as ORM; /** * GradebookScoreDisplay. - * - * @ORM\Table(name="gradebook_score_display", indexes={ - * @ORM\Index(name="category_id", columns={"category_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'gradebook_score_display')] +#[ORM\Index(name: 'category_id', columns: ['category_id'])] +#[ORM\Entity] class GradebookScoreDisplay { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $score; - /** - * @ORM\Column(name="display", type="string", length=40, nullable=false) - */ + #[ORM\Column(name: 'display', type: 'string', length: 40, nullable: false)] protected ?string $display = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class)] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $category; - /** - * @ORM\Column(name="score_color_percent", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score_color_percent', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $scoreColorPercent; public function setScore(float $score): self diff --git a/src/CoreBundle/Entity/GradebookScoreLog.php b/src/CoreBundle/Entity/GradebookScoreLog.php index c3e6c635c5..d3e10ec4d6 100644 --- a/src/CoreBundle/Entity/GradebookScoreLog.php +++ b/src/CoreBundle/Entity/GradebookScoreLog.php @@ -12,46 +12,32 @@ use Doctrine\ORM\Mapping as ORM; /** * GradebookScoreLog. - * - * @ORM\Table( - * name="gradebook_score_log", indexes={ - * @ORM\Index(name="idx_gradebook_score_log_user", columns={"user_id"}), - * @ORM\Index(name="idx_gradebook_score_log_user_category", columns={"user_id", "category_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'gradebook_score_log')] +#[ORM\Index(name: 'idx_gradebook_score_log_user', columns: ['user_id'])] +#[ORM\Index(name: 'idx_gradebook_score_log_user_category', columns: ['user_id', 'category_id'])] +#[ORM\Entity] class GradebookScoreLog { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class)] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookScoreLogs") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'gradeBookScoreLogs')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $score; - /** - * @ORM\Column(name="registered_at", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'registered_at', type: 'datetime', nullable: false)] protected DateTime $registeredAt; /** diff --git a/src/CoreBundle/Entity/Group.php b/src/CoreBundle/Entity/Group.php index 53df897e12..17a8b2b50e 100644 --- a/src/CoreBundle/Entity/Group.php +++ b/src/CoreBundle/Entity/Group.php @@ -13,47 +13,31 @@ use Symfony\Component\Validator\Constraints as Assert; /** * User platform roles. - * - * @ORM\Entity() - * @ORM\Table(name="fos_group") */ -class Group +#[ORM\Table(name: 'fos_group')] +#[ORM\Entity] +class Group implements \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false, unique=true) - */ - #[Assert\NotBlank] - protected string $name; - - /** - * @ORM\Column(name="code", type="string", length=40, nullable=false, unique=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'code', type: 'string', length: 40, nullable: false, unique: true)] protected string $code; /** - * @ORM\Column(name="roles", type="array") - */ - protected array $roles; - - /** - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\User", mappedBy="groups") - * * @var User[]|Collection */ + #[ORM\ManyToMany(targetEntity: \Chamilo\CoreBundle\Entity\User::class, mappedBy: 'groups')] protected Collection $users; - public function __construct(string $name, array $roles = []) + public function __construct(#[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false, unique: true)] + protected string $name, #[ORM\Column(name: 'roles', type: 'array')] + protected array $roles = []) { - $this->name = $name; - $this->roles = $roles; $this->users = new ArrayCollection(); } @@ -123,7 +107,7 @@ class Group /** * @return User[]|Collection */ - public function getUsers() + public function getUsers(): array|\Doctrine\Common\Collections\Collection { return $this->users; } diff --git a/src/CoreBundle/Entity/HookCall.php b/src/CoreBundle/Entity/HookCall.php index 42c8febbc1..4e1a4ceda4 100644 --- a/src/CoreBundle/Entity/HookCall.php +++ b/src/CoreBundle/Entity/HookCall.php @@ -10,42 +10,29 @@ use Doctrine\ORM\Mapping as ORM; /** * HookCall. - * - * @ORM\Table(name="hook_call") - * @ORM\Entity */ +#[ORM\Table(name: 'hook_call')] +#[ORM\Entity] class HookCall { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="hook_event_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hook_event_id', type: 'integer', nullable: false)] protected int $hookEventId; - /** - * @ORM\Column(name="hook_observer_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hook_observer_id', type: 'integer', nullable: false)] protected int $hookObserverId; - /** - * @ORM\Column(name="type", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'boolean', nullable: false)] protected bool $type; - /** - * @ORM\Column(name="hook_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hook_order', type: 'integer', nullable: false)] protected int $hookOrder; - /** - * @ORM\Column(name="enabled", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'enabled', type: 'boolean', nullable: false)] protected bool $enabled; /** diff --git a/src/CoreBundle/Entity/HookEvent.php b/src/CoreBundle/Entity/HookEvent.php index 975382fcae..1b9997ab1a 100644 --- a/src/CoreBundle/Entity/HookEvent.php +++ b/src/CoreBundle/Entity/HookEvent.php @@ -10,33 +10,21 @@ use Doctrine\ORM\Mapping as ORM; /** * HookEvent. - * - * @ORM\Table( - * name="hook_event", - * options={"row_format"="DYNAMIC"}, - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="class_name", columns={"class_name"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'hook_event', options: ['row_format' => 'DYNAMIC'])] +#[ORM\UniqueConstraint(name: 'class_name', columns: ['class_name'])] +#[ORM\Entity] class HookEvent { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="class_name", type="string", length=190, nullable=true) - */ + #[ORM\Column(name: 'class_name', type: 'string', length: 190, nullable: true)] protected ?string $className = null; - /** - * @ORM\Column(name="description", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'description', type: 'string', length: 255, nullable: true)] protected ?string $description = null; /** diff --git a/src/CoreBundle/Entity/HookObserver.php b/src/CoreBundle/Entity/HookObserver.php index b66c4d53e1..7722589847 100644 --- a/src/CoreBundle/Entity/HookObserver.php +++ b/src/CoreBundle/Entity/HookObserver.php @@ -10,38 +10,24 @@ use Doctrine\ORM\Mapping as ORM; /** * HookObserver. - * - * @ORM\Table( - * name="hook_observer", - * options={"row_format"="DYNAMIC"}, - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="class_name", columns={"class_name"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'hook_observer', options: ['row_format' => 'DYNAMIC'])] +#[ORM\UniqueConstraint(name: 'class_name', columns: ['class_name'])] +#[ORM\Entity] class HookObserver { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="class_name", type="string", length=190, nullable=true) - */ + #[ORM\Column(name: 'class_name', type: 'string', length: 190, nullable: true)] protected ?string $className = null; - /** - * @ORM\Column(name="path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)] protected string $path; - /** - * @ORM\Column(name="plugin_name", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'plugin_name', type: 'string', length: 255, nullable: true)] protected ?string $pluginName = null; /** diff --git a/src/CoreBundle/Entity/Illustration.php b/src/CoreBundle/Entity/Illustration.php index d1ee743a0c..e30f31ec7c 100644 --- a/src/CoreBundle/Entity/Illustration.php +++ b/src/CoreBundle/Entity/Illustration.php @@ -13,30 +13,24 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Uid\Uuid; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="illustration") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\IllustrationRepository") - */ #[ApiResource( normalizationContext: [ 'groups' => ['illustration:read'], ], )] -class Illustration extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'illustration')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\Node\IllustrationRepository::class)] +class Illustration extends AbstractResource implements ResourceInterface, \Stringable { use PersonalResourceTrait; use TimestampableEntity; - /** - * @ORM\Column(name="id", type="uuid") - * @ORM\Id - */ + #[ORM\Column(name: 'id', type: 'uuid')] + #[ORM\Id] protected Uuid $id; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; public function __construct() diff --git a/src/CoreBundle/Entity/Language.php b/src/CoreBundle/Entity/Language.php index 6d13dba80d..895edf51a1 100644 --- a/src/CoreBundle/Entity/Language.php +++ b/src/CoreBundle/Entity/Language.php @@ -6,6 +6,7 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\Entity; +use Chamilo\CoreBundle\Repository\LanguageRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -13,54 +14,36 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Platform languages. - * - * @ORM\Table( - * name="language", - * options={"row_format"="DYNAMIC"} - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\LanguageRepository") */ +#[ORM\Table(name: 'language', options: ['row_format' => 'DYNAMIC'])] +#[ORM\Entity(repositoryClass: LanguageRepository::class)] class Language { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="original_name", type="string", length=255, nullable=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'original_name', type: 'string', length: 255, nullable: true)] protected ?string $originalName = null; - /** - * @ORM\Column(name="english_name", type="string", length=255) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'english_name', type: 'string', length: 255)] protected string $englishName; - /** - * @ORM\Column(name="isocode", type="string", length=10) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'isocode', type: 'string', length: 10)] protected string $isocode; - /** - * @ORM\Column(name="available", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'available', type: 'boolean', nullable: false)] protected bool $available; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Language", inversedBy="subLanguages") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true) - */ + #[ORM\ManyToOne(targetEntity: Language::class, inversedBy: 'subLanguages')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', nullable: true)] protected ?Language $parent = null; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Language", mappedBy="parent") - */ + #[ORM\OneToMany(targetEntity: Language::class, mappedBy: 'parent')] protected Collection $subLanguages; public function __construct() diff --git a/src/CoreBundle/Entity/Legal.php b/src/CoreBundle/Entity/Legal.php index d6ab450775..097bfb50bd 100644 --- a/src/CoreBundle/Entity/Legal.php +++ b/src/CoreBundle/Entity/Legal.php @@ -10,47 +10,32 @@ use Doctrine\ORM\Mapping as ORM; /** * Legal. - * - * @ORM\Table(name="legal") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\LegalRepository") */ +#[ORM\Table(name: 'legal')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\LegalRepository::class)] class Legal { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="date", type="integer", nullable=false) - */ + #[ORM\Column(name: 'date', type: 'integer', nullable: false)] protected int $date; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'integer', nullable: false)] protected int $type; - /** - * @ORM\Column(name="changes", type="text", nullable=false) - */ + #[ORM\Column(name: 'changes', type: 'text', nullable: false)] protected string $changes; - /** - * @ORM\Column(name="version", type="integer", nullable=true) - */ + #[ORM\Column(name: 'version', type: 'integer', nullable: true)] protected ?int $version = null; - /** - * @ORM\Column(name="language_id", type="integer") - */ + #[ORM\Column(name: 'language_id', type: 'integer')] protected int $languageId; /** diff --git a/src/CoreBundle/Entity/Level.php b/src/CoreBundle/Entity/Level.php index 2daa43a9c5..6d7ed86e75 100644 --- a/src/CoreBundle/Entity/Level.php +++ b/src/CoreBundle/Entity/Level.php @@ -11,42 +11,29 @@ use Gedmo\Mapping\Annotation as Gedmo; /** * Skill level. - * - * @ORM\Table(name="skill_level") - * @ORM\Entity */ -class Level +#[ORM\Table(name: 'skill_level')] +#[ORM\Entity] +class Level implements \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @Gedmo\SortablePosition - * - * @ORM\Column(name="position", type="integer") - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; - /** - * @ORM\Column(name="short_name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'short_name', type: 'string', length: 255, nullable: false)] protected string $shortName; - /** - * @Gedmo\SortableGroup - * - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Profile", inversedBy="levels") - * @ORM\JoinColumn(name="profile_id", referencedColumnName="id") - */ + #[Gedmo\SortableGroup] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Profile::class, inversedBy: 'levels')] + #[ORM\JoinColumn(name: 'profile_id', referencedColumnName: 'id')] protected ?Profile $profile = null; public function __toString(): string diff --git a/src/CoreBundle/Entity/Listener/CourseListener.php b/src/CoreBundle/Entity/Listener/CourseListener.php index a28df3ccbe..784570c2e3 100644 --- a/src/CoreBundle/Entity/Listener/CourseListener.php +++ b/src/CoreBundle/Entity/Listener/CourseListener.php @@ -22,14 +22,8 @@ use Exception; */ class CourseListener { - protected ToolChain $toolChain; - - protected SettingsManager $settingsManager; - - public function __construct(ToolChain $toolChain, SettingsManager $settingsManager) + public function __construct(protected ToolChain $toolChain, protected SettingsManager $settingsManager) { - $this->toolChain = $toolChain; - $this->settingsManager = $settingsManager; } /** diff --git a/src/CoreBundle/Entity/Listener/MessageListener.php b/src/CoreBundle/Entity/Listener/MessageListener.php index ebd83bf3ea..26225787b1 100644 --- a/src/CoreBundle/Entity/Listener/MessageListener.php +++ b/src/CoreBundle/Entity/Listener/MessageListener.php @@ -12,11 +12,8 @@ use Symfony\Component\Messenger\MessageBusInterface; class MessageListener { - private MessageBusInterface $bus; - - public function __construct(MessageBusInterface $bus) + public function __construct(private MessageBusInterface $bus) { - $this->bus = $bus; } public function postPersist(Message $message, LifecycleEventArgs $args): void diff --git a/src/CoreBundle/Entity/Listener/ResourceListener.php b/src/CoreBundle/Entity/Listener/ResourceListener.php index 07aee2adf2..db1dc6254d 100644 --- a/src/CoreBundle/Entity/Listener/ResourceListener.php +++ b/src/CoreBundle/Entity/Listener/ResourceListener.php @@ -36,21 +36,8 @@ class ResourceListener { use AccessUrlListenerTrait; - protected SlugifyInterface $slugify; - protected Security $security; - protected ToolChain $toolChain; - protected RequestStack $request; - - public function __construct( - SlugifyInterface $slugify, - ToolChain $toolChain, - RequestStack $request, - Security $security - ) { - $this->slugify = $slugify; - $this->security = $security; - $this->toolChain = $toolChain; - $this->request = $request; + public function __construct(protected SlugifyInterface $slugify, protected ToolChain $toolChain, protected RequestStack $request, protected Security $security) + { } /** @@ -109,7 +96,7 @@ class ResourceListener // 3. Set ResourceType. // @todo use static table instead of Doctrine $resourceTypeRepo = $em->getRepository(ResourceType::class); - $entityClass = \get_class($eventArgs->getObject()); + $entityClass = $eventArgs->getObject()::class; $name = $this->toolChain->getResourceTypeNameByEntity($entityClass); @@ -170,7 +157,7 @@ class ResourceListener $resourceNodeIdFromRequest = $currentRequest->get('parentResourceNodeId'); if (empty($resourceNodeIdFromRequest)) { $contentData = $request->getCurrentRequest()->getContent(); - $contentData = json_decode($contentData, true); + $contentData = json_decode($contentData, true, 512, JSON_THROW_ON_ERROR); $resourceNodeIdFromRequest = $contentData['parentResourceNodeId'] ?? ''; } diff --git a/src/CoreBundle/Entity/Listener/ResourceNodeListener.php b/src/CoreBundle/Entity/Listener/ResourceNodeListener.php index 52e7c15d97..2788dd0562 100644 --- a/src/CoreBundle/Entity/Listener/ResourceNodeListener.php +++ b/src/CoreBundle/Entity/Listener/ResourceNodeListener.php @@ -17,26 +17,10 @@ use Symfony\Component\Security\Core\Security; class ResourceNodeListener { - protected SlugifyInterface $slugify; - protected Security $security; - protected ToolChain $toolChain; - protected RequestStack $request; - protected ResourceNodeRepository $resourceNodeRepository; //protected $accessUrl; - public function __construct( - SlugifyInterface $slugify, - ToolChain $toolChain, - RequestStack $request, - Security $security, - ResourceNodeRepository $resourceNodeRepository - ) { - $this->slugify = $slugify; - $this->security = $security; - $this->toolChain = $toolChain; - $this->request = $request; - //$this->accessUrl = null; - $this->resourceNodeRepository = $resourceNodeRepository; + public function __construct(protected SlugifyInterface $slugify, protected ToolChain $toolChain, protected RequestStack $request, protected Security $security, protected ResourceNodeRepository $resourceNodeRepository) + { } /*public function prePersist(ResourceNode $resourceNode, LifecycleEventArgs $event) diff --git a/src/CoreBundle/Entity/Listener/SessionListener.php b/src/CoreBundle/Entity/Listener/SessionListener.php index 59bdeb730e..2389e2d9c4 100644 --- a/src/CoreBundle/Entity/Listener/SessionListener.php +++ b/src/CoreBundle/Entity/Listener/SessionListener.php @@ -23,13 +23,8 @@ class SessionListener { use AccessUrlListenerTrait; - protected RequestStack $request; - protected Security $security; - - public function __construct(RequestStack $request, Security $security) + public function __construct(protected RequestStack $request, protected Security $security) { - $this->security = $security; - $this->request = $request; } /** diff --git a/src/CoreBundle/Entity/Listener/SkillRelUserListener.php b/src/CoreBundle/Entity/Listener/SkillRelUserListener.php index 00cf701896..9cafce8fc0 100644 --- a/src/CoreBundle/Entity/Listener/SkillRelUserListener.php +++ b/src/CoreBundle/Entity/Listener/SkillRelUserListener.php @@ -18,21 +18,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SkillRelUserListener { - protected Security $security; - private SettingsManager $settingsManager; - private RouterInterface $router; - private TranslatorInterface $translator; - - public function __construct( - SettingsManager $settingsManager, - RouterInterface $router, - TranslatorInterface $translator, - Security $security - ) { - $this->settingsManager = $settingsManager; - $this->router = $router; - $this->translator = $translator; - $this->security = $security; + public function __construct(private SettingsManager $settingsManager, private RouterInterface $router, private TranslatorInterface $translator, protected Security $security) + { } public function postPersist(SkillRelUser $skillRelUser, LifecycleEventArgs $event): void diff --git a/src/CoreBundle/Entity/Listener/UserListener.php b/src/CoreBundle/Entity/Listener/UserListener.php index ccac8591c7..b9f328430e 100644 --- a/src/CoreBundle/Entity/Listener/UserListener.php +++ b/src/CoreBundle/Entity/Listener/UserListener.php @@ -15,13 +15,8 @@ use Symfony\Component\Security\Core\Security; class UserListener { - private UserRepository $userRepository; - private Security $security; - - public function __construct(UserRepository $userRepository, Security $security) + public function __construct(private UserRepository $userRepository, private Security $security) { - $this->userRepository = $userRepository; - $this->security = $security; } /** diff --git a/src/CoreBundle/Entity/Listener/UserRelUserListener.php b/src/CoreBundle/Entity/Listener/UserRelUserListener.php index ad90b16dfc..45b211f309 100644 --- a/src/CoreBundle/Entity/Listener/UserRelUserListener.php +++ b/src/CoreBundle/Entity/Listener/UserRelUserListener.php @@ -14,11 +14,8 @@ use Symfony\Component\Security\Core\Security; class UserRelUserListener { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function prePersist(UserRelUser $userRelUser, LifecycleEventArgs $args): void diff --git a/src/CoreBundle/Entity/MailTemplate.php b/src/CoreBundle/Entity/MailTemplate.php index 1c4603df83..a784b4c5cc 100644 --- a/src/CoreBundle/Entity/MailTemplate.php +++ b/src/CoreBundle/Entity/MailTemplate.php @@ -9,53 +9,35 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="mail_template") - * @ORM\Entity - */ +#[ORM\Table(name: 'mail_template')] +#[ORM\Entity] class MailTemplate { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', nullable: false)] protected string $name; - /** - * @ORM\Column(name="template", type="text", nullable=true) - */ + #[ORM\Column(name: 'template', type: 'text', nullable: true)] protected ?string $template = null; - /** - * @ORM\Column(name="type", type="string", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'string', nullable: false)] protected string $type; - /** - * @ORM\Column(name="score", type="float", nullable=true) - */ + #[ORM\Column(name: 'score', type: 'float', nullable: true)] protected float $authorId; - /** - * @ORM\Column(name="result_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'result_id', type: 'integer', nullable: false)] protected int $urlId; - /** - * @ORM\Column(name="default_template", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'default_template', type: 'boolean', nullable: false)] protected bool $defaultTemplate; - /** - * @ORM\Column(name="`system`", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: '`system`', type: 'integer', nullable: false, options: ['default' => 0])] protected bool $system; } diff --git a/src/CoreBundle/Entity/Message.php b/src/CoreBundle/Entity/Message.php index 2ad1e18fb7..4b4ceef805 100644 --- a/src/CoreBundle/Entity/Message.php +++ b/src/CoreBundle/Entity/Message.php @@ -21,15 +21,6 @@ use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="message", indexes={ - * @ORM\Index(name="idx_message_user_sender", columns={"user_sender_id"}), - * @ORM\Index(name="idx_message_group", columns={"group_id"}), - * @ORM\Index(name="idx_message_type", columns={"msg_type"}) - * }) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\MessageRepository") - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\MessageListener"}) - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -94,6 +85,12 @@ use Symfony\Component\Validator\Constraints as Assert; 'receivers.tags.tag' => 'exact', 'parent' => 'exact', ])] +#[ORM\Table(name: 'message')] +#[ORM\Index(name: 'idx_message_user_sender', columns: ['user_sender_id'])] +#[ORM\Index(name: 'idx_message_group', columns: ['group_id'])] +#[ORM\Index(name: 'idx_message_type', columns: ['msg_type'])] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\MessageRepository::class)] +#[ORM\EntityListeners([\Chamilo\CoreBundle\Entity\Listener\MessageListener::class])] class Message { public const MESSAGE_TYPE_INBOX = 1; @@ -108,31 +105,26 @@ class Message public const MESSAGE_STATUS_INVITATION_ACCEPTED = 6; public const MESSAGE_STATUS_INVITATION_DENIED = 7; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[ApiProperty(identifier: true)] #[Groups(['message:read'])] + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sentMessages") - * @ORM\JoinColumn(name="user_sender_id", referencedColumnName="id", nullable=false) - */ #[Assert\NotBlank] #[Groups(['message:read', 'message:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'sentMessages')] + #[ORM\JoinColumn(name: 'user_sender_id', referencedColumnName: 'id', nullable: false)] protected User $sender; /** * @var Collection|MessageRelUser[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageRelUser", mappedBy="message", cascade={"persist", "remove"}) */ #[Assert\Valid] #[Groups(['message:read', 'message:write'])] #[ApiSubresource] + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\MessageRelUser::class, mappedBy: 'message', cascade: ['persist', 'remove'])] protected array | null | Collection $receivers; /** @@ -147,9 +139,6 @@ class Message #[Groups(['message:read', 'message:write'])] protected array | null | Collection $receiversCc; - /** - * @ORM\Column(name="msg_type", type="smallint", nullable=false) - */ #[Assert\NotBlank] // @todo use enums with PHP 8.1 /*#[Assert\Choice([ @@ -164,74 +153,58 @@ class Message ], ])]*/ #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'msg_type', type: 'smallint', nullable: false)] protected int $msgType; - /** - * @ORM\Column(name="status", type="smallint", nullable=false) - */ #[Assert\NotBlank] #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'status', type: 'smallint', nullable: false)] protected int $status; - /** - * @ORM\Column(name="send_date", type="datetime", nullable=false) - */ #[Groups(['message:read'])] + #[ORM\Column(name: 'send_date', type: 'datetime', nullable: false)] protected DateTime $sendDate; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=false) - */ #[Assert\NotBlank] #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'content', type: 'text', nullable: false)] protected string $content; #[Groups(['message:read', 'message:write'])] - protected ?MessageRelUser $firstReceiver; + protected ?MessageRelUser $firstReceiver = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") - * @ORM\JoinColumn(name="group_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class)] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Usergroup $group = null; /** * @var Collection|Message[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Message", mappedBy="parent") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\Message::class, mappedBy: 'parent')] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ #[Groups(['message:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Message::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id')] protected ?Message $parent = null; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(name="update_date", type="datetime", nullable=true) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'update_date', type: 'datetime', nullable: true)] protected ?DateTime $updateDate; - /** - * @ORM\Column(name="votes", type="integer", nullable=true) - */ + #[ORM\Column(name: 'votes', type: 'integer', nullable: true)] protected ?int $votes; /** * @var Collection|MessageAttachment[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageAttachment", mappedBy="message", cascade={"remove", "persist"}) */ #[Groups(['message:read'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\MessageAttachment::class, mappedBy: 'message', cascade: ['remove', 'persist'])] protected Collection $attachments; public function __construct() @@ -252,7 +225,7 @@ class Message /** * @return null|Collection|MessageRelUser[] */ - public function getReceivers() + public function getReceivers(): null|\Doctrine\Common\Collections\Collection|array { return $this->receivers; } @@ -336,10 +309,7 @@ class Message return $this; } - /** - * @param Collection|MessageRelUser $receivers - */ - public function setReceivers($receivers): self + public function setReceivers(\Doctrine\Common\Collections\Collection|\Chamilo\CoreBundle\Entity\MessageRelUser $receivers): self { /** @var MessageRelUser $receiver */ foreach ($receivers as $receiver) { @@ -459,7 +429,7 @@ class Message * * @return Collection|MessageAttachment[] */ - public function getAttachments() + public function getAttachments(): \Doctrine\Common\Collections\Collection|array { return $this->attachments; } @@ -480,7 +450,7 @@ class Message /** * @return Collection|Message[] */ - public function getChildren() + public function getChildren(): \Doctrine\Common\Collections\Collection|array { return $this->children; } @@ -507,7 +477,7 @@ class Message public function setGroup(?Usergroup $group): self { -// $this->msgType = self::MESSAGE_TYPE_GROUP; + // $this->msgType = self::MESSAGE_TYPE_GROUP; $this->group = $group; return $this; diff --git a/src/CoreBundle/Entity/MessageAttachment.php b/src/CoreBundle/Entity/MessageAttachment.php index 7733debe28..952f4f2309 100644 --- a/src/CoreBundle/Entity/MessageAttachment.php +++ b/src/CoreBundle/Entity/MessageAttachment.php @@ -11,10 +11,6 @@ use Chamilo\CoreBundle\Controller\Api\CreateMessageAttachmentAction; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\Table(name="message_attachment") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\MessageAttachmentRepository") - */ #[ApiResource( collectionOperations: [ 'get', @@ -49,40 +45,30 @@ use Symfony\Component\Serializer\Annotation\Groups; itemOperations: ['get'], normalizationContext: ['groups' => 'message:read'], )] -class MessageAttachment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'message_attachment')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\Node\MessageAttachmentRepository::class)] +class MessageAttachment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)] protected string $path; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ #[Groups(['message:read'])] + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="size", type="integer", nullable=false) - */ + #[ORM\Column(name: 'size', type: 'integer', nullable: false)] protected int $size; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="attachments", cascade={"persist"}) - * @ORM\JoinColumn(name="message_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Message::class, inversedBy: 'attachments', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'message_id', referencedColumnName: 'id', nullable: false)] protected Message $message; - /** - * @ORM\Column(name="filename", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)] protected string $filename; public function __construct() diff --git a/src/CoreBundle/Entity/MessageRelUser.php b/src/CoreBundle/Entity/MessageRelUser.php index 197316b087..c81ed88ab6 100644 --- a/src/CoreBundle/Entity/MessageRelUser.php +++ b/src/CoreBundle/Entity/MessageRelUser.php @@ -16,14 +16,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="message_rel_user", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="message_receiver", columns={"message_id", "user_id"}) - * }, - * ) - * @ORM\Entity() - */ #[UniqueEntity( fields: ['message', 'receiver'], errorPath: 'message', @@ -38,59 +30,49 @@ use Symfony\Component\Validator\Constraints as Assert; 'starred' => 'exact', 'tags.tag' => 'exact', ])] +#[ORM\Table(name: 'message_rel_user')] +#[ORM\UniqueConstraint(name: 'message_receiver', columns: ['message_id', 'user_id'])] +#[ORM\Entity] class MessageRelUser { public const TYPE_TO = 1; public const TYPE_CC = 2; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="receivers", cascade={"persist"}) - * @ORM\JoinColumn(name="message_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Message::class, inversedBy: 'receivers', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'message_id', referencedColumnName: 'id', nullable: false)] protected Message $message; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", cascade={"persist"}, inversedBy="receivedMessages") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['message:read', 'message:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, cascade: ['persist'], inversedBy: 'receivedMessages')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $receiver; - /** - * @ORM\Column(name="msg_read", type="boolean", nullable=false) - */ #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'msg_read', type: 'boolean', nullable: false)] protected bool $read; - /** - * @ORM\Column(name="receiver_type", type="smallint", nullable=false) - */ #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'receiver_type', type: 'smallint', nullable: false)] protected int $receiverType; - /** - * @ORM\Column(name="starred", type="boolean", nullable=false) - */ #[Groups(['message:read', 'message:write'])] + #[ORM\Column(name: 'starred', type: 'boolean', nullable: false)] protected bool $starred; /** * @var Collection|MessageTag[] - * - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageTag", inversedBy="messageRelUsers", cascade={"persist", "remove"}) - * @ORM\JoinTable(name="message_rel_user_rel_tags") */ #[Assert\Valid] #[Groups(['message:read', 'message:write'])] + #[ORM\JoinTable(name: 'message_rel_user_rel_tags')] + #[ORM\ManyToMany(targetEntity: \Chamilo\CoreBundle\Entity\MessageTag::class, inversedBy: 'messageRelUsers', cascade: ['persist', 'remove'])] protected Collection $tags; public function __construct() @@ -109,7 +91,7 @@ class MessageRelUser /** * @return Collection|MessageTag[] */ - public function getTags() + public function getTags(): \Doctrine\Common\Collections\Collection|array { return $this->tags; } diff --git a/src/CoreBundle/Entity/MessageTag.php b/src/CoreBundle/Entity/MessageTag.php index 1b863f5201..9dfa6799dd 100644 --- a/src/CoreBundle/Entity/MessageTag.php +++ b/src/CoreBundle/Entity/MessageTag.php @@ -18,17 +18,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="message_tag", - * uniqueConstraints={ - * @ORM\UniqueConstraint( - * name="user_tag", - * columns={"user_id", "tag"}) - * }, - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\MessageTagRepository") - */ #[UniqueEntity( fields: ['user', 'tag'], errorPath: 'tag', @@ -68,52 +57,44 @@ use Symfony\Component\Validator\Constraints as Assert; 'user' => 'exact', 'tag' => 'exact', ])] +#[ORM\Table(name: 'message_tag')] +#[ORM\UniqueConstraint(name: 'user_tag', columns: ['user_id', 'tag'])] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\MessageTagRepository::class)] class MessageTag { use TimestampableTypedEntity; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups(['message_tag:read', 'message:read'])] + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @Gedmo\SortableGroup() - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="messageTags") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="cascade") - */ #[Assert\NotBlank] #[Groups(['message_tag:read', 'message_tag:write'])] + #[Gedmo\SortableGroup] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'messageTags')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'cascade')] protected User $user; - /** - * @ORM\Column(name="tag", type="string", nullable=false) - */ #[Assert\NotBlank] #[Groups(['message_tag:read', 'message_tag:write', 'message:read'])] + #[ORM\Column(name: 'tag', type: 'string', nullable: false)] protected string $tag; - /** - * @ORM\Column(name="color", type="string", nullable=false) - */ #[Assert\NotBlank] #[Groups(['message_tag:read', 'message_tag:write'])] + #[ORM\Column(name: 'color', type: 'string', nullable: false)] protected string $color; - /** - * @Gedmo\SortablePosition() - * @ORM\Column(name="position", type="integer") - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; /** * @var Collection|MessageRelUser[] - * - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageRelUser", mappedBy="tags", cascade={"persist"}) */ + #[ORM\ManyToMany(targetEntity: \Chamilo\CoreBundle\Entity\MessageRelUser::class, mappedBy: 'tags', cascade: ['persist'])] protected Collection $messageRelUsers; public function __construct() diff --git a/src/CoreBundle/Entity/Notification.php b/src/CoreBundle/Entity/Notification.php index c56ddcd5d9..2c2ba3911e 100644 --- a/src/CoreBundle/Entity/Notification.php +++ b/src/CoreBundle/Entity/Notification.php @@ -10,62 +10,37 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table( - * name="notification", - * indexes={ - * @ORM\Index(name="mail_notify_sent_index", columns={"sent_at"}), - * @ORM\Index( - * name="mail_notify_freq_index", - * columns={"sent_at", "send_freq", "created_at"} - * ) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'notification')] +#[ORM\Index(name: 'mail_notify_sent_index', columns: ['sent_at'])] +#[ORM\Index(name: 'mail_notify_freq_index', columns: ['sent_at', 'send_freq', 'created_at'])] +#[ORM\Entity] class Notification { - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="dest_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'dest_user_id', type: 'integer', nullable: false)] protected int $destUserId; - /** - * @ORM\Column(name="dest_mail", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'dest_mail', type: 'string', length: 255, nullable: true)] protected ?string $destMail = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: true)] protected ?string $title = null; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="send_freq", type="smallint", nullable=true) - */ + #[ORM\Column(name: 'send_freq', type: 'smallint', nullable: true)] protected ?int $sendFreq = null; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; - /** - * @ORM\Column(name="sent_at", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'sent_at', type: 'datetime', nullable: true)] protected ?DateTime $sentAt = null; /** diff --git a/src/CoreBundle/Entity/NotificationEvent.php b/src/CoreBundle/Entity/NotificationEvent.php index c96e2757b0..ef51f3aac2 100644 --- a/src/CoreBundle/Entity/NotificationEvent.php +++ b/src/CoreBundle/Entity/NotificationEvent.php @@ -8,52 +8,34 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="notification_event") - * @ORM\Entity - */ +#[ORM\Table(name: 'notification_event')] +#[ORM\Entity] class NotificationEvent { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $id; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected string $content; - /** - * @ORM\Column(name="link", type="text", nullable=true) - */ + #[ORM\Column(name: 'link', type: 'text', nullable: true)] protected string $link; - /** - * @ORM\Column(name="persistent", type="integer", nullable=true) - */ + #[ORM\Column(name: 'persistent', type: 'integer', nullable: true)] protected int $persistent; - /** - * @ORM\Column(name="day_diff", type="integer", nullable=true) - */ + #[ORM\Column(name: 'day_diff', type: 'integer', nullable: true)] protected int $dayDiff; - /** - * @ORM\Column(name="event_type", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'event_type', type: 'string', length: 255, nullable: false)] protected string $eventType; - /** - * @ORM\Column(name="event_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'event_id', type: 'integer', nullable: true)] protected int $eventId; public function getId(): int diff --git a/src/CoreBundle/Entity/Page.php b/src/CoreBundle/Entity/Page.php index 1755ce9b50..bde6b5035a 100644 --- a/src/CoreBundle/Entity/Page.php +++ b/src/CoreBundle/Entity/Page.php @@ -16,14 +16,6 @@ use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="page", - * indexes={ - * } - * ) - * @ORM\Entity - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -61,82 +53,60 @@ use Symfony\Component\Validator\Constraints as Assert; #[ApiFilter(OrderFilter::class, properties: [ 'title', ])] +#[ORM\Table(name: 'page')] +#[ORM\Entity] class Page { use TimestampableTypedEntity; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255) - */ #[Assert\NotBlank] #[Groups(['page:read', 'page:write'])] + #[ORM\Column(name: 'title', type: 'string', length: 255)] protected string $title; - /** - * @ORM\Column(name="content", type="text") - */ #[Groups(['page:read', 'page:write'])] #[Assert\NotBlank] + #[ORM\Column(name: 'content', type: 'text')] protected string $content; - /** - * @Gedmo\Slug( - * fields={"title"}, - * updatable=true, - * unique=true, - * ) - * @ORM\Column(name="slug", type="string", length=255) - */ + #[Gedmo\Slug(fields: ['title'], updatable: true, unique: true)] + #[ORM\Column(name: 'slug', type: 'string', length: 255)] protected string $slug; - /** - * @ORM\Column(name="enabled", type="boolean", nullable=false) - */ #[Groups(['page:read', 'page:write'])] + #[ORM\Column(name: 'enabled', type: 'boolean', nullable: false)] protected bool $enabled; - /** - * @Gedmo\SortablePosition - * @ORM\Column(name="position", type="integer") - */ #[Groups(['page:read', 'page:write'])] + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; - /** - * @ORM\Column(name="locale", type="string", length=10) - */ #[Groups(['page:read', 'page:write'])] + #[ORM\Column(name: 'locale', type: 'string', length: 10)] protected string $locale; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['page:read', 'page:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrl::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected AccessUrl $url; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['page:read', 'page:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'creator_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected User $creator; - /** - * @Gedmo\SortableGroup - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\PageCategory", inversedBy="pages") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="SET NULL") - */ #[Groups(['page:read', 'page:write'])] + #[Gedmo\SortableGroup] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\PageCategory::class, inversedBy: 'pages')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?PageCategory $category = null; public function __construct() diff --git a/src/CoreBundle/Entity/PageCategory.php b/src/CoreBundle/Entity/PageCategory.php index cfe561efa2..d1a8ec72cd 100644 --- a/src/CoreBundle/Entity/PageCategory.php +++ b/src/CoreBundle/Entity/PageCategory.php @@ -14,14 +14,6 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="page_category", - * indexes={ - * } - * ) - * @ORM\Entity - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -49,43 +41,37 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['page_category:read'], ], )] +#[ORM\Table(name: 'page_category')] +#[ORM\Entity] class PageCategory { use TimestampableTypedEntity; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups(['page_category:read', 'page_category:write'])] + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255) - */ #[Assert\NotBlank] #[Groups(['page_category:read', 'page_category:write', 'page:read'])] + #[ORM\Column(name: 'title', type: 'string', length: 255)] protected string $title; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'creator_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected User $creator; - /** - * @ORM\Column(name="type", type="string") - */ #[Groups(['page_category:read', 'page_category:write', 'page:read'])] #[Assert\NotBlank] + #[ORM\Column(name: 'type', type: 'string')] protected string $type; /** * @var Collection|Page[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Page", mappedBy="category", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: Page::class, mappedBy: 'category', cascade: ['persist'])] protected Collection $pages; public function __construct() diff --git a/src/CoreBundle/Entity/PersonalAgenda.php b/src/CoreBundle/Entity/PersonalAgenda.php index 58e0140e38..124b8b089a 100644 --- a/src/CoreBundle/Entity/PersonalAgenda.php +++ b/src/CoreBundle/Entity/PersonalAgenda.php @@ -13,65 +13,44 @@ use Symfony\Component\Validator\Constraints as Assert; /** * PersonalAgenda. - * - * @ORM\Table(name="personal_agenda", indexes={ - * @ORM\Index(name="idx_personal_agenda_user", columns={"user"}), - * @ORM\Index(name="idx_personal_agenda_parent", columns={"parent_event_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'personal_agenda')] +#[ORM\Index(name: 'idx_personal_agenda_user', columns: ['user'])] +#[ORM\Index(name: 'idx_personal_agenda_parent', columns: ['parent_event_id'])] +#[ORM\Entity] class PersonalAgenda { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="personalAgendas") - * @ORM\JoinColumn(name="user", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'personalAgendas')] + #[ORM\JoinColumn(name: 'user', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @Assert\NotBlank() - * - * @ORM\Column(name="title", type="text", nullable=true) - */ + #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: true)] protected ?string $title = null; - /** - * @ORM\Column(name="text", type="text", nullable=true) - */ + #[ORM\Column(name: 'text', type: 'text', nullable: true)] protected ?string $text = null; - /** - * @ORM\Column(name="date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'date', type: 'datetime', nullable: true)] protected ?DateTime $date = null; - /** - * @ORM\Column(name="enddate", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'enddate', type: 'datetime', nullable: true)] protected ?DateTime $endDate = null; - /** - * @ORM\Column(name="parent_event_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'parent_event_id', type: 'integer', nullable: true)] protected ?int $parentEventId = null; - /** - * @ORM\Column(name="all_day", type="integer", nullable=false) - */ + #[ORM\Column(name: 'all_day', type: 'integer', nullable: false)] protected int $allDay; - /** - * @ORM\Column(name="color", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'color', type: 'string', length: 20, nullable: true)] protected ?string $color = null; /** diff --git a/src/CoreBundle/Entity/PersonalAgendaRepeat.php b/src/CoreBundle/Entity/PersonalAgendaRepeat.php index 72667f1274..4c4a78f5f3 100644 --- a/src/CoreBundle/Entity/PersonalAgendaRepeat.php +++ b/src/CoreBundle/Entity/PersonalAgendaRepeat.php @@ -10,37 +10,26 @@ use Doctrine\ORM\Mapping as ORM; /** * PersonalAgendaRepeat. - * - * @ORM\Table(name="personal_agenda_repeat") - * @ORM\Entity */ +#[ORM\Table(name: 'personal_agenda_repeat')] +#[ORM\Entity] class PersonalAgendaRepeat { - /** - * @ORM\Column(name="cal_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'cal_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $calId; - /** - * @ORM\Column(name="cal_type", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'cal_type', type: 'string', length: 20, nullable: true)] protected ?string $calType = null; - /** - * @ORM\Column(name="cal_end", type="integer", nullable=true) - */ + #[ORM\Column(name: 'cal_end', type: 'integer', nullable: true)] protected ?int $calEnd = null; - /** - * @ORM\Column(name="cal_frequency", type="integer", nullable=true) - */ + #[ORM\Column(name: 'cal_frequency', type: 'integer', nullable: true)] protected ?int $calFrequency = null; - /** - * @ORM\Column(name="cal_days", type="string", length=7, nullable=true) - */ + #[ORM\Column(name: 'cal_days', type: 'string', length: 7, nullable: true)] protected ?string $calDays = null; /** diff --git a/src/CoreBundle/Entity/PersonalAgendaRepeatNot.php b/src/CoreBundle/Entity/PersonalAgendaRepeatNot.php index 86c70f251c..adb1af7e8d 100644 --- a/src/CoreBundle/Entity/PersonalAgendaRepeatNot.php +++ b/src/CoreBundle/Entity/PersonalAgendaRepeatNot.php @@ -10,24 +10,19 @@ use Doctrine\ORM\Mapping as ORM; /** * PersonalAgendaRepeatNot. - * - * @ORM\Table(name="personal_agenda_repeat_not") - * @ORM\Entity */ +#[ORM\Table(name: 'personal_agenda_repeat_not')] +#[ORM\Entity] class PersonalAgendaRepeatNot { - /** - * @ORM\Column(name="cal_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'cal_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected int $calId; - /** - * @ORM\Column(name="cal_date", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Column(name: 'cal_date', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'NONE')] protected int $calDate; /** diff --git a/src/CoreBundle/Entity/PersonalFile.php b/src/CoreBundle/Entity/PersonalFile.php index 3883c14b8a..e792bd56e4 100644 --- a/src/CoreBundle/Entity/PersonalFile.php +++ b/src/CoreBundle/Entity/PersonalFile.php @@ -13,6 +13,8 @@ use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Serializer\Filter\PropertyFilter; use Chamilo\CoreBundle\Controller\Api\CreatePersonalFileAction; use Chamilo\CoreBundle\Controller\Api\UpdatePersonalFileAction; +use Chamilo\CoreBundle\Entity\Listener\ResourceListener; +use Chamilo\CoreBundle\Repository\Node\PersonalFileRepository; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Serializer\Annotation\Groups; @@ -93,10 +95,6 @@ use Symfony\Component\Validator\Constraints as Assert; * }, * }, * ) - * - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\ResourceListener"}) - * @ORM\Table(name="personal_file") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\PersonalFileRepository") */ #[ApiFilter(SearchFilter::class, properties: [ 'title' => 'partial', @@ -113,24 +111,23 @@ use Symfony\Component\Validator\Constraints as Assert; 'resourceNode.updatedAt', ] )] +#[ORM\Table(name: 'personal_file')] +#[ORM\EntityListeners([ResourceListener::class])] +#[ORM\Entity(repositoryClass: PersonalFileRepository::class)] -class PersonalFile extends AbstractResource implements ResourceInterface +class PersonalFile extends AbstractResource implements ResourceInterface, \Stringable { use TimestampableEntity; - /** - * @Groups({"personal_file:read"}) - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Groups(['personal_file:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] #[Groups(['personal_file:read'])] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; public function __construct() diff --git a/src/CoreBundle/Entity/Portfolio.php b/src/CoreBundle/Entity/Portfolio.php index 1ff663350a..c1c9344eb4 100644 --- a/src/CoreBundle/Entity/Portfolio.php +++ b/src/CoreBundle/Entity/Portfolio.php @@ -12,76 +12,51 @@ use Doctrine\ORM\Mapping as ORM; /** * Class Portfolio. - * - * @ORM\Table( - * name="portfolio", - * indexes={ - * @ORM\Index(name="user", columns={"user_id"}), - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session", columns={"session_id"}), - * @ORM\Index(name="category", columns={"category_id"}) - * } - * ) - * @ORM\Entity() */ +#[ORM\Table(name: 'portfolio')] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'session', columns: ['session_id'])] +#[ORM\Index(name: 'category', columns: ['category_id'])] +#[ORM\Entity] class Portfolio { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text") - */ + #[ORM\Column(name: 'content', type: 'text')] protected string $content; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id')] protected Session $session; - /** - * @ORM\Column(name="creation_date", type="datetime") - */ + #[ORM\Column(name: 'creation_date', type: 'datetime')] protected DateTime $creationDate; - /** - * @ORM\Column(name="update_date", type="datetime") - */ + #[ORM\Column(name: 'update_date', type: 'datetime')] protected DateTime $updateDate; - /** - * @ORM\Column(name="is_visible", type="boolean", options={"default":true}) - */ + #[ORM\Column(name: 'is_visible', type: 'boolean', options: ['default' => true])] protected bool $isVisible = true; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\PortfolioCategory", inversedBy="items") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\PortfolioCategory::class, inversedBy: 'items')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] protected PortfolioCategory $category; public function __construct() diff --git a/src/CoreBundle/Entity/PortfolioCategory.php b/src/CoreBundle/Entity/PortfolioCategory.php index 622fcde34c..411b7fa587 100644 --- a/src/CoreBundle/Entity/PortfolioCategory.php +++ b/src/CoreBundle/Entity/PortfolioCategory.php @@ -13,50 +13,33 @@ use Doctrine\ORM\Mapping as ORM; /** * Class PortfolioCategory. - * - * @ORM\Table( - * name="portfolio_category", - * indexes={ - * @ORM\Index(name="user", columns={"user_id"}) - * } - * ) - * @ORM\Entity */ -class PortfolioCategory +#[ORM\Table(name: 'portfolio_category')] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Entity] +class PortfolioCategory implements \Stringable { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="is_visible", type="boolean", options={"default":true}) - */ + #[ORM\Column(name: 'is_visible', type: 'boolean', options: ['default' => true])] protected bool $isVisible = true; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Portfolio", mappedBy="category") - */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\Portfolio::class, mappedBy: 'category')] protected ArrayCollection $items; public function __construct() @@ -103,10 +86,8 @@ class PortfolioCategory /** * Get description. - * - * @return null|string */ - public function getDescription() + public function getDescription(): ?string { return $this->description; } diff --git a/src/CoreBundle/Entity/Profile.php b/src/CoreBundle/Entity/Profile.php index cd0db55fbc..96f53c2e0e 100644 --- a/src/CoreBundle/Entity/Profile.php +++ b/src/CoreBundle/Entity/Profile.php @@ -10,37 +10,30 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="skill_level_profile") - * @ORM\Entity - */ -class Profile +#[ORM\Table(name: 'skill_level_profile')] +#[ORM\Entity] +class Profile implements \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Skill", mappedBy="profile", cascade={"persist"}) - * * @var Skill[]|Collection */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, mappedBy: 'profile', cascade: ['persist'])] protected Collection $skills; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Level", mappedBy="profile", cascade={"persist"}) - * @ORM\OrderBy({"position"="ASC"}) * * @var Level[]|Collection */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\Level::class, mappedBy: 'profile', cascade: ['persist'])] + #[ORM\OrderBy(['position' => 'ASC'])] protected Collection $levels; public function __construct() @@ -77,7 +70,7 @@ class Profile /** * @return Skill[]|Collection */ - public function getSkills() + public function getSkills(): array|\Doctrine\Common\Collections\Collection { return $this->skills; } @@ -85,7 +78,7 @@ class Profile /** * @param Skill[]|Collection $skills */ - public function setSkills($skills): self + public function setSkills(array|\Doctrine\Common\Collections\Collection $skills): self { $this->skills = $skills; @@ -95,7 +88,7 @@ class Profile /** * @return Level[]|Collection */ - public function getLevels() + public function getLevels(): array|\Doctrine\Common\Collections\Collection { return $this->levels; } diff --git a/src/CoreBundle/Entity/Promotion.php b/src/CoreBundle/Entity/Promotion.php index 616d815389..6772777822 100644 --- a/src/CoreBundle/Entity/Promotion.php +++ b/src/CoreBundle/Entity/Promotion.php @@ -12,10 +12,8 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="promotion") - * @ORM\Entity - */ +#[ORM\Table(name: 'promotion')] +#[ORM\Entity] class Promotion { use TimestampableEntity; @@ -23,47 +21,35 @@ class Promotion public const PROMOTION_STATUS_ACTIVE = 1; public const PROMOTION_STATUS_INACTIVE = 0; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected ?string $description = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Career", inversedBy="promotions") - * @ORM\JoinColumn(name="career_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Career::class, inversedBy: 'promotions')] + #[ORM\JoinColumn(name: 'career_id', referencedColumnName: 'id')] protected Career $career; /** * @var Collection|Session[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="promotion", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, mappedBy: 'promotion', cascade: ['persist'])] protected Collection $sessions; /** * @var Collection|SysAnnouncement[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SysAnnouncement", mappedBy="promotion", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\SysAnnouncement::class, mappedBy: 'promotion', cascade: ['persist'])] protected Collection $announcements; - /** - * @ORM\Column(name="status", type="integer", nullable=false) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: false)] protected int $status; public function __construct() @@ -144,7 +130,7 @@ class Promotion /** * @return Session[]|Collection */ - public function getSessions() + public function getSessions(): array|\Doctrine\Common\Collections\Collection { return $this->sessions; } @@ -159,7 +145,7 @@ class Promotion /** * @return SysAnnouncement[]|Collection */ - public function getAnnouncements() + public function getAnnouncements(): array|\Doctrine\Common\Collections\Collection { return $this->announcements; } @@ -167,7 +153,7 @@ class Promotion /** * @param SysAnnouncement[]|Collection $announcements */ - public function setAnnouncements($announcements): self + public function setAnnouncements(array|\Doctrine\Common\Collections\Collection $announcements): self { $this->announcements = $announcements; diff --git a/src/CoreBundle/Entity/ResetPasswordRequest.php b/src/CoreBundle/Entity/ResetPasswordRequest.php index 25de3ae686..f00b271c1a 100644 --- a/src/CoreBundle/Entity/ResetPasswordRequest.php +++ b/src/CoreBundle/Entity/ResetPasswordRequest.php @@ -9,30 +9,19 @@ use Doctrine\ORM\Mapping as ORM; use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestInterface; use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestTrait; -/** - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ResetPasswordRequestRepository") - */ +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\ResetPasswordRequestRepository::class)] class ResetPasswordRequest implements ResetPasswordRequestInterface { use ResetPasswordRequestTrait; - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: 'integer')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * - * @var null|\Chamilo\CoreBundle\Entity\User|object - */ - private $user; - - public function __construct(object $user, DateTimeInterface $expiresAt, string $selector, string $hashedToken) + public function __construct(#[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + private ?object $user, DateTimeInterface $expiresAt, string $selector, string $hashedToken) { - $this->user = $user; $this->initialize($expiresAt, $selector, $hashedToken); } diff --git a/src/CoreBundle/Entity/Resource/ResourceTag.php b/src/CoreBundle/Entity/Resource/ResourceTag.php index 8ddb38904b..e25a55f016 100644 --- a/src/CoreBundle/Entity/Resource/ResourceTag.php +++ b/src/CoreBundle/Entity/Resource/ResourceTag.php @@ -10,29 +10,21 @@ use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Entity - * @ORM\Table(name="resource_tag") - */ +#[ORM\Table(name: 'resource_tag')] +#[ORM\Entity] class ResourceTag { use TimestampableEntity; - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', nullable: false)] protected string $name; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="author_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'author_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?User $author = null; } diff --git a/src/CoreBundle/Entity/Resource/ResourceUserTag.php b/src/CoreBundle/Entity/Resource/ResourceUserTag.php index 8f9ab18e39..423ff12460 100644 --- a/src/CoreBundle/Entity/Resource/ResourceUserTag.php +++ b/src/CoreBundle/Entity/Resource/ResourceUserTag.php @@ -10,30 +10,22 @@ use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Entity - * @ORM\Table(name="resource_user_tag") - */ +#[ORM\Table(name: 'resource_user_tag')] +#[ORM\Entity] class ResourceUserTag { use TimestampableEntity; - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?User $user = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceTag") - * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Resource\ResourceTag::class)] + #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?ResourceTag $tag = null; } diff --git a/src/CoreBundle/Entity/ResourceComment.php b/src/CoreBundle/Entity/ResourceComment.php index 125b4c48e3..d1fa0d479c 100644 --- a/src/CoreBundle/Entity/ResourceComment.php +++ b/src/CoreBundle/Entity/ResourceComment.php @@ -23,82 +23,56 @@ use Symfony\Component\Validator\Constraints as Assert; * attributes={"security"="is_granted('ROLE_ADMIN')"}, * normalizationContext={"groups"={"comment:read"}} * ). - * - * @Gedmo\Tree(type="nested") - * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository") - * @ORM\Table(name="resource_comment") */ +#[ORM\Table(name: 'resource_comment')] +#[Gedmo\Tree(type: 'nested')] +#[ORM\Entity(repositoryClass: \Gedmo\Tree\Entity\Repository\NestedTreeRepository::class)] class ResourceComment { use TimestampableTypedEntity; use TimestampableAgoTrait; use NestedSetEntity; - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue(strategy="AUTO") - * @Groups({"comment:read"}) - */ + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue(strategy: 'AUTO')] + #[Groups(['comment:read'])] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", inversedBy="comments") - * @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, inversedBy: 'comments')] + #[ORM\JoinColumn(name: 'resource_node_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ResourceNode $resourceNode; - /** - * @Groups({"comment:read"}) - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="author_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[Groups(['comment:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'author_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $author; - /** - * @Groups({"comment:read"}) - * - * @ORM\Column(name="content", type="string", nullable=false) - */ #[Assert\NotBlank] + #[Groups(['comment:read'])] + #[ORM\Column(name: 'content', type: 'string', nullable: false)] protected string $content; - /** - * @Gedmo\TreeParent - * - * @ORM\ManyToOne( - * targetEntity="Chamilo\CoreBundle\Entity\ResourceComment", - * inversedBy="children" - * ) - * @ORM\JoinColumns({ - * @ORM\JoinColumn(onDelete="CASCADE") - * }) - */ + #[ORM\JoinColumn(onDelete: 'CASCADE')] + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceComment::class, inversedBy: 'children')] protected ?ResourceComment $parent = null; - /** - * @Groups({"comment:read"}) - * @Gedmo\Timestampable(on="create") - * @ORM\Column(type="datetime") - */ + #[Groups(['comment:read'])] + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(type: 'datetime')] protected DateTime $createdAt; - /** - * @Groups({"comment:read"}) - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") - */ + #[Groups(['comment:read'])] + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected DateTime $updatedAt; /** * @var Collection|ResourceComment[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\ResourceComment", - * mappedBy="parent" - * ) - * @ORM\OrderBy({"id"="ASC"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceComment::class, mappedBy: 'parent')] + #[ORM\OrderBy(['id' => 'ASC'])] protected Collection $children; public function __construct() @@ -164,7 +138,7 @@ class ResourceComment /** * @return ResourceComment[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } @@ -172,7 +146,7 @@ class ResourceComment /** * @param ResourceComment[]|Collection $children */ - public function setChildren(Collection $children): self + public function setChildren(array|\Doctrine\Common\Collections\Collection $children): self { $this->children = $children; diff --git a/src/CoreBundle/Entity/ResourceFile.php b/src/CoreBundle/Entity/ResourceFile.php index 73a80e0456..b3c702f367 100644 --- a/src/CoreBundle/Entity/ResourceFile.php +++ b/src/CoreBundle/Entity/ResourceFile.php @@ -63,56 +63,42 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich; * ) * @Vich\Uploadable * @ApiFilter(OrderFilter::class, properties={"id", "name", "size", "updatedAt"}) - * @ORM\Entity - * @ORM\Table(name="resource_file") */ #[ApiFilter(PropertyFilter::class)] #[ApiFilter(SearchFilter::class, properties: [ 'name' => 'partial', ])] -class ResourceFile +#[ORM\Table(name: 'resource_file')] +#[ORM\Entity] +class ResourceFile implements \Stringable { use TimestampableEntity; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read"}) - * - * @ORM\Column(type="string", length=255) - */ #[Assert\NotBlank] + #[Groups(['resource_file:read', 'resource_node:read', 'document:read'])] + #[ORM\Column(type: 'string', length: 255)] protected ?string $name = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - * @ORM\Column(type="text", nullable=true) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $mimeType = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - * @ORM\Column(type="text", nullable=true) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $originalName = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read"}) - * @ORM\Column(type="simple_array", nullable=true) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read'])] + #[ORM\Column(type: 'simple_array', nullable: true)] protected ?array $dimensions; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - * - * @ORM\Column(type="integer") - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] + #[ORM\Column(type: 'integer')] protected ?int $size = 0; /** @@ -125,61 +111,48 @@ class ResourceFile * dimensions="dimensions" * ) */ -// #[Vich\UploadableField( -// mapping: 'resources', -// fileNameProperty: 'name', -// size: 'size', -// mimeType: 'mimeType', -// originalName: 'originalName', -// dimensions: 'dimensions' -// )] + // #[Vich\UploadableField( + // mapping: 'resources', + // fileNameProperty: 'name', + // size: 'size', + // mimeType: 'mimeType', + // originalName: 'originalName', + // dimensions: 'dimensions' + // )] protected ?File $file = null; - /** - * @ORM\Column(name="crop", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'crop', type: 'string', length: 255, nullable: true)] protected ?string $crop = null; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="resourceFile") - */ + #[ORM\OneToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, mappedBy: 'resourceFile')] protected ResourceNode $resourceNode; /** * @var string[] - * - * @ORM\Column(type="array", nullable=true) */ + #[ORM\Column(type: 'array', nullable: true)] protected ?array $metadata = []; #[Groups(['message:read'])] protected ?bool $audio = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] protected ?bool $image = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] protected ?bool $video = null; - /** - * @Groups({"resource_file:read", "resource_node:read", "document:read", "message:read"}) - */ + #[Groups(['resource_file:read', 'resource_node:read', 'document:read', 'message:read'])] protected ?bool $text = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** * @var DateTime|DateTimeImmutable - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected $updatedAt; public function __construct() @@ -401,7 +374,7 @@ class ResourceFile /** * @param File|UploadedFile|null $file */ - public function setFile(?File $file = null): self + public function setFile(\Symfony\Component\HttpFoundation\File\File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $file = null): self { $this->file = $file; diff --git a/src/CoreBundle/Entity/ResourceLink.php b/src/CoreBundle/Entity/ResourceLink.php index 1b1f594243..065478d8f2 100644 --- a/src/CoreBundle/Entity/ResourceLink.php +++ b/src/CoreBundle/Entity/ResourceLink.php @@ -16,12 +16,10 @@ use Doctrine\ORM\Mapping as ORM; use LogicException; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\Entity - * @ORM\Table(name="resource_link") - */ #[ApiResource] -class ResourceLink +#[ORM\Table(name: 'resource_link')] +#[ORM\Entity] +class ResourceLink implements \Stringable { use TimestampableTypedEntity; @@ -30,75 +28,51 @@ class ResourceLink public const VISIBILITY_PUBLISHED = 2; public const VISIBILITY_DELETED = 3; - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue - */ + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", inversedBy="resourceLinks") - * @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, inversedBy: 'resourceLinks')] + #[ORM\JoinColumn(name: 'resource_node_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ResourceNode $resourceNode; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Course $course = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="resourceLinks") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'resourceLinks')] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroup") - * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CGroup::class)] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')] protected ?CGroup $group = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class)] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Usergroup $userGroup = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true, onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] protected ?User $user = null; /** * @var Collection|ResourceRight[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\ResourceRight", - * mappedBy="resourceLink", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceRight::class, mappedBy: 'resourceLink', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $resourceRights; - /** - * @ORM\Column(name="visibility", type="integer", nullable=false) - */ #[Groups(['ctool:read', 'c_tool_intro:read'])] + #[ORM\Column(name: 'visibility', type: 'integer', nullable: false)] protected int $visibility; - /** - * @ORM\Column(name="start_visibility_at", type="datetime", nullable=true) - */ #[Groups(['resource_node:read', 'resource_node:write', 'document:write', 'document:read'])] + #[ORM\Column(name: 'start_visibility_at', type: 'datetime', nullable: true)] protected ?DateTimeInterface $startVisibilityAt = null; - /** - * @ORM\Column(name="end_visibility_at", type="datetime", nullable=true) - */ #[Groups(['resource_node:read', 'resource_node:write', 'document:write', 'document:read'])] + #[ORM\Column(name: 'end_visibility_at', type: 'datetime', nullable: true)] protected ?DateTimeInterface $endVisibilityAt = null; public function __construct() @@ -139,7 +113,7 @@ class ResourceLink /** * @param ResourceRight[]|Collection $rights */ - public function setResourceRights($rights): self + public function setResourceRights(array|\Doctrine\Common\Collections\Collection $rights): self { $this->resourceRights = $rights; @@ -163,7 +137,7 @@ class ResourceLink /** * @return Collection|ResourceRight[] */ - public function getResourceRights() + public function getResourceRights(): \Doctrine\Common\Collections\Collection|array { return $this->resourceRights; } @@ -316,6 +290,6 @@ class ResourceLink public function getVisibilityName(): string { - return array_flip($this->getVisibilityList())[$this->getVisibility()]; + return array_flip(static::getVisibilityList())[$this->getVisibility()]; } } diff --git a/src/CoreBundle/Entity/ResourceNode.php b/src/CoreBundle/Entity/ResourceNode.php index 1928ed6065..ab75ac9dad 100644 --- a/src/CoreBundle/Entity/ResourceNode.php +++ b/src/CoreBundle/Entity/ResourceNode.php @@ -31,13 +31,8 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Base entity for all resources. * - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\ResourceNodeRepository") * - * @ORM\HasLifecycleCallbacks - * @ORM\Table(name="resource_node") - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\ResourceNodeListener"}) * - * @Gedmo\Tree(type="materializedPath") */ #[ApiResource( collectionOperations: [ @@ -61,101 +56,82 @@ use Symfony\Component\Validator\Constraints as Assert; #[ApiFilter(SearchFilter::class, properties: [ 'title' => 'partial', ])] -class ResourceNode +#[ORM\Table(name: 'resource_node')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\ResourceNodeRepository::class)] +#[ORM\HasLifecycleCallbacks] +#[ORM\EntityListeners([\Chamilo\CoreBundle\Entity\Listener\ResourceNodeListener::class])] +#[Gedmo\Tree(type: 'materializedPath')] +class ResourceNode implements \Stringable { use TimestampableTypedEntity; use TimestampableAgoTrait; public const PATH_SEPARATOR = '/'; - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue(strategy="AUTO") - */ #[Groups(['resource_node:read', 'document:read', 'ctool:read', 'user_json:read'])] + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @Gedmo\TreePathSource - * - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Groups(['resource_node:read', 'resource_node:write', 'document:read', 'document:write'])] #[Assert\NotBlank] + #[Gedmo\TreePathSource] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @Gedmo\Slug(fields={"title"}) - * @ORM\Column(name="slug", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[Gedmo\Slug(fields: ['title'])] + #[ORM\Column(name: 'slug', type: 'string', length: 255, nullable: false)] protected string $slug; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceType", inversedBy="resourceNodes") - * @ORM\JoinColumn(name="resource_type_id", referencedColumnName="id", nullable=false) - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceType::class, inversedBy: 'resourceNodes')] + #[ORM\JoinColumn(name: 'resource_type_id', referencedColumnName: 'id', nullable: false)] protected ResourceType $resourceType; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceLink", mappedBy="resourceNode", cascade={"persist", "remove"}) */ #[ApiSubresource] #[Groups(['ctool:read', 'c_tool_intro:read'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceLink::class, mappedBy: 'resourceNode', cascade: ['persist', 'remove'])] protected Collection $resourceLinks; /** * ResourceFile available file for this node. - * - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceFile", inversedBy="resourceNode", orphanRemoval=true) - * @ORM\JoinColumn(name="resource_file_id", referencedColumnName="id", onDelete="CASCADE") */ #[Groups(['resource_node:read', 'resource_node:write', 'document:read', 'document:write', 'message:read'])] + #[ORM\OneToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceFile::class, inversedBy: 'resourceNode', orphanRemoval: true)] + #[ORM\JoinColumn(name: 'resource_file_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?ResourceFile $resourceFile = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="resourceNodes") - * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['resource_node:read', 'resource_node:write', 'document:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'resourceNodes')] + #[ORM\JoinColumn(name: 'creator_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected User $creator; - /** - * @Gedmo\TreeParent - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", inversedBy="children") - * @ORM\JoinColumns({ - * @ORM\JoinColumn(name="parent_id", onDelete="CASCADE") - * }) - */ #[ApiSubresource] + #[ORM\JoinColumn(name: 'parent_id', onDelete: 'CASCADE')] + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, inversedBy: 'children')] protected ?ResourceNode $parent = null; /** * @var Collection|ResourceNode[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="parent") - * @ORM\OrderBy({"id"="ASC"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, mappedBy: 'parent')] + #[ORM\OrderBy(['id' => 'ASC'])] protected Collection $children; - /** - * @Gedmo\TreeLevel - * - * @ORM\Column(name="level", type="integer", nullable=true) - */ + #[Gedmo\TreeLevel] + #[ORM\Column(name: 'level', type: 'integer', nullable: true)] protected ?int $level = null; - /** - * @Gedmo\TreePath(appendId=true, separator="/") - * - * @ORM\Column(name="path", type="text", nullable=true) - */ #[Groups(['resource_node:read', 'document:read'])] + #[Gedmo\TreePath(appendId: true, separator: '/')] + #[ORM\Column(name: 'path', type: 'text', nullable: true)] protected ?string $path = null; /** @@ -168,49 +144,34 @@ class ResourceNode /** * @var Collection|ResourceComment[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceComment", mappedBy="resourceNode", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceComment::class, mappedBy: 'resourceNode', cascade: ['persist', 'remove'])] protected Collection $comments; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(type="datetime") - */ #[Groups(['resource_node:read', 'document:read'])] + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(type: 'datetime')] protected DateTime $createdAt; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") - */ #[Groups(['resource_node:read', 'document:read'])] + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected DateTime $updatedAt; #[Groups(['resource_node:read', 'document:read'])] protected bool $fileEditableText; - /** - * @ORM\Column(type="boolean") - */ #[Groups(['resource_node:read', 'document:read'])] + #[ORM\Column(type: 'boolean')] protected bool $public; protected ?string $content = null; - /** - * @ORM\OneToOne( - * targetEntity="Chamilo\CourseBundle\Entity\CShortcut", - * mappedBy="shortCutNode", - * cascade={"persist", "remove"} - * ) - */ + #[ORM\OneToOne(targetEntity: \Chamilo\CourseBundle\Entity\CShortcut::class, mappedBy: 'shortCutNode', cascade: ['persist', 'remove'])] protected ?CShortcut $shortCut = null; - /** - * @ORM\Column(type="uuid", unique=true) - */ #[Groups(['resource_node:read', 'document:read'])] + #[ORM\Column(type: 'uuid', unique: true)] protected ?UuidV4 $uuid = null; public function __construct() @@ -266,7 +227,7 @@ class ResourceNode * * @return Collection|ResourceNode[] */ - public function getChildren() + public function getChildren(): \Doctrine\Common\Collections\Collection|array { return $this->children; } @@ -283,10 +244,8 @@ class ResourceNode /** * Returns the parent resource. - * - * @return null|ResourceNode */ - public function getParent() + public function getParent(): ?\Chamilo\CoreBundle\Entity\ResourceNode { return $this->parent; } @@ -314,7 +273,7 @@ class ResourceNode /** * @return Collection|ResourceComment[] */ - public function getComments() + public function getComments(): \Doctrine\Common\Collections\Collection|array { return $this->comments; } diff --git a/src/CoreBundle/Entity/ResourceRight.php b/src/CoreBundle/Entity/ResourceRight.php index f226b8a834..9cc65d6f10 100644 --- a/src/CoreBundle/Entity/ResourceRight.php +++ b/src/CoreBundle/Entity/ResourceRight.php @@ -8,33 +8,23 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * @ORM\Table(name="resource_right") - */ -class ResourceRight +#[ORM\Table(name: 'resource_right')] +#[ORM\Entity] +class ResourceRight implements \Stringable { - /** - * @ORM\Id - * @ORM\Column(type="bigint") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(type: 'bigint')] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceLink", inversedBy="resourceRights") - * @ORM\JoinColumn(name="resource_link_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceLink::class, inversedBy: 'resourceRights')] + #[ORM\JoinColumn(name: 'resource_link_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?ResourceLink $resourceLink = null; - /** - * @ORM\Column(name="role", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'role', type: 'string', length: 255, nullable: false)] protected string $role; - /** - * @ORM\Column(name="mask", type="integer", nullable=false) - */ + #[ORM\Column(name: 'mask', type: 'integer', nullable: false)] protected int $mask; public function __toString(): string diff --git a/src/CoreBundle/Entity/ResourceType.php b/src/CoreBundle/Entity/ResourceType.php index a0fc738294..447f96bb4e 100644 --- a/src/CoreBundle/Entity/ResourceType.php +++ b/src/CoreBundle/Entity/ResourceType.php @@ -12,38 +12,29 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * @ORM\Table(name="resource_type") - */ -class ResourceType +#[ORM\Table(name: 'resource_type')] +#[ORM\Entity] +class ResourceType implements \Stringable { use TimestampableEntity; - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue - */ + #[ORM\Id] + #[ORM\Column(type: 'integer')] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column() - */ #[Assert\NotBlank] + #[ORM\Column] protected string $name; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tool", inversedBy="resourceTypes") - * @ORM\JoinColumn(name="tool_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Tool::class, inversedBy: 'resourceTypes')] + #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id')] protected Tool $tool; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="resourceType", cascade={"persist", "remove"}) - * * @var ResourceNode[]|Collection */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, mappedBy: 'resourceType', cascade: ['persist', 'remove'])] protected Collection $resourceNodes; public function __construct() @@ -88,7 +79,7 @@ class ResourceType /** * @return ResourceNode[]|Collection */ - public function getResourceNodes() + public function getResourceNodes(): array|\Doctrine\Common\Collections\Collection { return $this->resourceNodes; } @@ -96,7 +87,7 @@ class ResourceType /** * @param ResourceNode[]|Collection $resourceNodes */ - public function setResourceNodes($resourceNodes): self + public function setResourceNodes(array|\Doctrine\Common\Collections\Collection $resourceNodes): self { $this->resourceNodes = $resourceNodes; diff --git a/src/CoreBundle/Entity/Room.php b/src/CoreBundle/Entity/Room.php index 59a7682e01..4c4789e53b 100644 --- a/src/CoreBundle/Entity/Room.php +++ b/src/CoreBundle/Entity/Room.php @@ -11,49 +11,34 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Room. - * - * @ORM\Table(name="room") - * @ORM\Entity */ +#[ORM\Table(name: 'room')] +#[ORM\Entity] class Room { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="geolocation", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'geolocation', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $geolocation = null; - /** - * @ORM\Column(name="ip", type="string", length=45, nullable=true, unique=false) - */ + #[ORM\Column(name: 'ip', type: 'string', length: 45, nullable: true, unique: false)] protected ?string $ip = null; - /** - * @ORM\Column(name="ip_mask", type="string", length=6, nullable=true, unique=false) - */ + #[ORM\Column(name: 'ip_mask', type: 'string', length: 6, nullable: true, unique: false)] protected ?string $ipMask = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\BranchSync") - * @ORM\JoinColumn(name="branch_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\BranchSync::class)] + #[ORM\JoinColumn(name: 'branch_id', referencedColumnName: 'id')] protected BranchSync $branch; /** diff --git a/src/CoreBundle/Entity/ScheduledAnnouncement.php b/src/CoreBundle/Entity/ScheduledAnnouncement.php index 0b9f87e63d..b7b6ee03c6 100644 --- a/src/CoreBundle/Entity/ScheduledAnnouncement.php +++ b/src/CoreBundle/Entity/ScheduledAnnouncement.php @@ -11,47 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * ScheduledAnnouncement. - * - * @ORM\Table(name="scheduled_announcements") - * @ORM\Entity */ +#[ORM\Table(name: 'scheduled_announcements')] +#[ORM\Entity] class ScheduledAnnouncement { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="subject", type="string", length=255) - */ + #[ORM\Column(name: 'subject', type: 'string', length: 255)] protected string $subject; - /** - * @ORM\Column(name="message", type="text", unique=false) - */ + #[ORM\Column(name: 'message', type: 'text', unique: false)] protected string $message; - /** - * @ORM\Column(name="date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'date', type: 'datetime', nullable: true)] protected ?DateTime $date = null; - /** - * @ORM\Column(name="sent", type="boolean") - */ + #[ORM\Column(name: 'sent', type: 'boolean')] protected bool $sent; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="c_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: true)] protected ?int $cId = null; public function __construct() diff --git a/src/CoreBundle/Entity/SearchEngineRef.php b/src/CoreBundle/Entity/SearchEngineRef.php index fc838a2eaf..85c45c96c6 100644 --- a/src/CoreBundle/Entity/SearchEngineRef.php +++ b/src/CoreBundle/Entity/SearchEngineRef.php @@ -10,43 +10,30 @@ use Doctrine\ORM\Mapping as ORM; /** * SearchEngineRef. - * - * @ORM\Table(name="search_engine_ref") - * @ORM\Entity */ +#[ORM\Table(name: 'search_engine_ref')] +#[ORM\Entity] class SearchEngineRef { - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="searchEngineRefs") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'searchEngineRefs')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected ?Course $course = null; - /** - * @ORM\Column(name="tool_id", type="string", length=100, nullable=false) - */ + #[ORM\Column(name: 'tool_id', type: 'string', length: 100, nullable: false)] protected string $toolId; - /** - * @ORM\Column(name="ref_id_high_level", type="integer", nullable=false) - */ + #[ORM\Column(name: 'ref_id_high_level', type: 'integer', nullable: false)] protected int $refIdHighLevel; - /** - * @ORM\Column(name="ref_id_second_level", type="integer", nullable=true) - */ + #[ORM\Column(name: 'ref_id_second_level', type: 'integer', nullable: true)] protected ?int $refIdSecondLevel = null; - /** - * @ORM\Column(name="search_did", type="integer", nullable=false) - */ + #[ORM\Column(name: 'search_did', type: 'integer', nullable: false)] protected int $searchDid; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; /** diff --git a/src/CoreBundle/Entity/Sequence.php b/src/CoreBundle/Entity/Sequence.php index d850563c84..3c3fe286d6 100644 --- a/src/CoreBundle/Entity/Sequence.php +++ b/src/CoreBundle/Entity/Sequence.php @@ -10,29 +10,21 @@ use Doctrine\ORM\Mapping as ORM; use Fhaculty\Graph\Graph; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="sequence") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\SequenceRepository") - */ -class Sequence +#[ORM\Table(name: 'sequence')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\SequenceRepository::class)] +class Sequence implements \Stringable { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string") - */ + #[ORM\Column(name: 'name', type: 'string')] protected string $name; - /** - * @ORM\Column(name="graph", type="text", nullable=true) - */ + #[ORM\Column(name: 'graph', type: 'text', nullable: true)] protected ?string $graph = null; public function __toString(): string diff --git a/src/CoreBundle/Entity/SequenceCondition.php b/src/CoreBundle/Entity/SequenceCondition.php index 599d32cf7b..0330597e7a 100644 --- a/src/CoreBundle/Entity/SequenceCondition.php +++ b/src/CoreBundle/Entity/SequenceCondition.php @@ -10,42 +10,29 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceCondition. - * - * @ORM\Table(name="sequence_condition") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_condition')] +#[ORM\Entity] class SequenceCondition { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; - /** - * @ORM\Column(name="mat_op", type="string") - */ + #[ORM\Column(name: 'mat_op', type: 'string')] protected string $mathOperation; - /** - * @ORM\Column(name="param", type="float") - */ + #[ORM\Column(name: 'param', type: 'float')] protected string $param; - /** - * @ORM\Column(name="act_true", type="integer") - */ + #[ORM\Column(name: 'act_true', type: 'integer')] protected string $actTrue; - /** - * @ORM\Column(name="act_false", type="string") - */ + #[ORM\Column(name: 'act_false', type: 'string')] protected string $actFalse; /** @@ -66,9 +53,6 @@ class SequenceCondition return $this->description; } - /** - * @return SequenceCondition - */ public function setDescription(string $description): self { $this->description = $description; @@ -99,9 +83,6 @@ class SequenceCondition return $this->param; } - /** - * @return SequenceCondition - */ public function setParam(string $param): self { $this->param = $param; @@ -117,9 +98,6 @@ class SequenceCondition return $this->actTrue; } - /** - * @return SequenceCondition - */ public function setActTrue(string $actTrue): self { $this->actTrue = $actTrue; @@ -135,9 +113,6 @@ class SequenceCondition return $this->actFalse; } - /** - * @return SequenceCondition - */ public function setActFalse(string $actFalse): self { $this->actFalse = $actFalse; diff --git a/src/CoreBundle/Entity/SequenceFormula.php b/src/CoreBundle/Entity/SequenceFormula.php index ffb4cd2c39..eac7bae0f4 100644 --- a/src/CoreBundle/Entity/SequenceFormula.php +++ b/src/CoreBundle/Entity/SequenceFormula.php @@ -10,29 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceFormula. - * - * @ORM\Table(name="sequence_formula") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_formula')] +#[ORM\Entity] class SequenceFormula { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceMethod") - * @ORM\JoinColumn(name="sequence_method_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceMethod::class)] + #[ORM\JoinColumn(name: 'sequence_method_id', referencedColumnName: 'id')] protected ?SequenceMethod $method = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceVariable") - * @ORM\JoinColumn(name="sequence_variable_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceVariable::class)] + #[ORM\JoinColumn(name: 'sequence_variable_id', referencedColumnName: 'id')] protected ?SequenceVariable $variable = null; /** diff --git a/src/CoreBundle/Entity/SequenceMethod.php b/src/CoreBundle/Entity/SequenceMethod.php index fbe808ed74..5a9c55ab78 100644 --- a/src/CoreBundle/Entity/SequenceMethod.php +++ b/src/CoreBundle/Entity/SequenceMethod.php @@ -10,42 +10,29 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceMethod. - * - * @ORM\Table(name="sequence_method") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_method')] +#[ORM\Entity] class SequenceMethod { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; - /** - * @ORM\Column(name="formula", type="text") - */ + #[ORM\Column(name: 'formula', type: 'text')] protected string $formula; - /** - * @ORM\Column(name="assign", type="integer") - */ + #[ORM\Column(name: 'assign', type: 'integer')] protected string $assign; - /** - * @ORM\Column(name="met_type", type="string") - */ + #[ORM\Column(name: 'met_type', type: 'string')] protected string $metType; - /** - * @ORM\Column(name="act_false", type="string") - */ + #[ORM\Column(name: 'act_false', type: 'string')] protected string $actFalse; /** @@ -66,9 +53,6 @@ class SequenceMethod return $this->description; } - /** - * @return SequenceMethod - */ public function setDescription(string $description): self { $this->description = $description; @@ -84,9 +68,6 @@ class SequenceMethod return $this->formula; } - /** - * @return SequenceMethod - */ public function setFormula(string $formula): self { $this->formula = $formula; @@ -102,9 +83,6 @@ class SequenceMethod return $this->assign; } - /** - * @return SequenceMethod - */ public function setAssign(string $assign): self { $this->assign = $assign; @@ -120,9 +98,6 @@ class SequenceMethod return $this->metType; } - /** - * @return SequenceMethod - */ public function setMetType(string $metType): self { $this->metType = $metType; @@ -138,9 +113,6 @@ class SequenceMethod return $this->actFalse; } - /** - * @return SequenceMethod - */ public function setActFalse(string $actFalse): self { $this->actFalse = $actFalse; diff --git a/src/CoreBundle/Entity/SequenceResource.php b/src/CoreBundle/Entity/SequenceResource.php index a15351ed4a..3ad07d5417 100644 --- a/src/CoreBundle/Entity/SequenceResource.php +++ b/src/CoreBundle/Entity/SequenceResource.php @@ -10,36 +10,27 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceResource. - * - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\SequenceResourceRepository") - * @ORM\Table(name="sequence_resource") */ +#[ORM\Table(name: 'sequence_resource')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\SequenceResourceRepository::class)] class SequenceResource { public const COURSE_TYPE = 1; public const SESSION_TYPE = 2; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Sequence") - * @ORM\JoinColumn(name="sequence_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Sequence::class)] + #[ORM\JoinColumn(name: 'sequence_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Sequence $sequence; - /** - * @ORM\Column(name="type", type="integer") - */ + #[ORM\Column(name: 'type', type: 'integer')] protected int $type; - /** - * @ORM\Column(name="resource_id", type="integer") - */ + #[ORM\Column(name: 'resource_id', type: 'integer')] protected int $resourceId; /** @@ -62,8 +53,6 @@ class SequenceResource /** * Set the integer type. - * - * @return SequenceResource */ public function setType(int $type): self { diff --git a/src/CoreBundle/Entity/SequenceRowEntity.php b/src/CoreBundle/Entity/SequenceRowEntity.php index f83288d036..3c3a3f030a 100644 --- a/src/CoreBundle/Entity/SequenceRowEntity.php +++ b/src/CoreBundle/Entity/SequenceRowEntity.php @@ -10,43 +10,30 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceRowEntity. - * - * @ORM\Table(name="sequence_row_entity") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_row_entity')] +#[ORM\Entity] class SequenceRowEntity { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="session_id", type="integer") - */ + #[ORM\Column(name: 'session_id', type: 'integer')] protected int $sessionId; - /** - * @ORM\Column(name="row_id", type="integer") - */ + #[ORM\Column(name: 'row_id', type: 'integer')] protected int $rowId; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceTypeEntity") - * @ORM\JoinColumn(name="sequence_type_entity_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: SequenceTypeEntity::class)] + #[ORM\JoinColumn(name: 'sequence_type_entity_id', referencedColumnName: 'id')] protected ?SequenceTypeEntity $type = null; /** @@ -67,9 +54,6 @@ class SequenceRowEntity return $this->cId; } - /** - * @return SequenceRowEntity - */ public function setCId(int $cId): self { $this->cId = $cId; @@ -85,9 +69,6 @@ class SequenceRowEntity return $this->sessionId; } - /** - * @return SequenceRowEntity - */ public function setSessionId(int $sessionId): self { $this->sessionId = $sessionId; @@ -103,9 +84,6 @@ class SequenceRowEntity return $this->rowId; } - /** - * @return SequenceRowEntity - */ public function setRowId(int $rowId): self { $this->rowId = $rowId; @@ -121,9 +99,6 @@ class SequenceRowEntity return $this->name; } - /** - * @return SequenceRowEntity - */ public function setName(string $name): self { $this->name = $name; @@ -136,9 +111,6 @@ class SequenceRowEntity return $this->type; } - /** - * @return SequenceRowEntity - */ public function setType(?SequenceTypeEntity $type): self { $this->type = $type; diff --git a/src/CoreBundle/Entity/SequenceRule.php b/src/CoreBundle/Entity/SequenceRule.php index c9126f6b88..57956710ec 100644 --- a/src/CoreBundle/Entity/SequenceRule.php +++ b/src/CoreBundle/Entity/SequenceRule.php @@ -10,22 +10,17 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceRule. - * - * @ORM\Table(name="sequence_rule") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_rule')] +#[ORM\Entity] class SequenceRule { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; /** @@ -46,9 +41,6 @@ class SequenceRule return $this->description; } - /** - * @return SequenceRule - */ public function setDescription(string $description): self { $this->description = $description; diff --git a/src/CoreBundle/Entity/SequenceRuleCondition.php b/src/CoreBundle/Entity/SequenceRuleCondition.php index a9268bc31d..f0911abc58 100644 --- a/src/CoreBundle/Entity/SequenceRuleCondition.php +++ b/src/CoreBundle/Entity/SequenceRuleCondition.php @@ -10,29 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceRuleCondition. - * - * @ORM\Table(name="sequence_rule_condition") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_rule_condition')] +#[ORM\Entity] class SequenceRuleCondition { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceRule") - * @ORM\JoinColumn(name="sequence_rule_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceRule::class)] + #[ORM\JoinColumn(name: 'sequence_rule_id', referencedColumnName: 'id')] protected ?SequenceRule $rule = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceCondition") - * @ORM\JoinColumn(name="sequence_condition_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceCondition::class)] + #[ORM\JoinColumn(name: 'sequence_condition_id', referencedColumnName: 'id')] protected ?SequenceCondition $condition = null; /** diff --git a/src/CoreBundle/Entity/SequenceRuleMethod.php b/src/CoreBundle/Entity/SequenceRuleMethod.php index 1d0afb1c00..e99a3a270c 100644 --- a/src/CoreBundle/Entity/SequenceRuleMethod.php +++ b/src/CoreBundle/Entity/SequenceRuleMethod.php @@ -10,34 +10,25 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceRuleMethod. - * - * @ORM\Table(name="sequence_rule_method") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_rule_method')] +#[ORM\Entity] class SequenceRuleMethod { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="method_order", type="integer") - */ + #[ORM\Column(name: 'method_order', type: 'integer')] protected string $methodOrder; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceRule") - * @ORM\JoinColumn(name="sequence_rule_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: SequenceRule::class)] + #[ORM\JoinColumn(name: 'sequence_rule_id', referencedColumnName: 'id')] protected ?SequenceRule $rule = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceMethod") - * @ORM\JoinColumn(name="sequence_method_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: SequenceMethod::class)] + #[ORM\JoinColumn(name: 'sequence_method_id', referencedColumnName: 'id')] protected ?SequenceMethod $method = null; /** diff --git a/src/CoreBundle/Entity/SequenceTypeEntity.php b/src/CoreBundle/Entity/SequenceTypeEntity.php index cd1e96e338..e879a5c834 100644 --- a/src/CoreBundle/Entity/SequenceTypeEntity.php +++ b/src/CoreBundle/Entity/SequenceTypeEntity.php @@ -10,32 +10,23 @@ use Doctrine\ORM\Mapping as ORM; /** * Class SequenceTypeEntity. - * - * @ORM\Table(name="sequence_type_entity") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_type_entity')] +#[ORM\Entity] class SequenceTypeEntity { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; - /** - * @ORM\Column(name="ent_table", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'ent_table', type: 'string', length: 255, nullable: false)] protected string $entityTable; /** @@ -56,9 +47,6 @@ class SequenceTypeEntity return $this->name; } - /** - * @return SequenceTypeEntity - */ public function setName(string $name): self { $this->name = $name; @@ -74,9 +62,6 @@ class SequenceTypeEntity return $this->description; } - /** - * @return SequenceTypeEntity - */ public function setDescription(string $description): self { $this->description = $description; @@ -92,9 +77,6 @@ class SequenceTypeEntity return $this->entityTable; } - /** - * @return SequenceTypeEntity - */ public function setEntityTable(string $entityTable): self { $this->entityTable = $entityTable; diff --git a/src/CoreBundle/Entity/SequenceValid.php b/src/CoreBundle/Entity/SequenceValid.php index a44fffd071..13a4955129 100644 --- a/src/CoreBundle/Entity/SequenceValid.php +++ b/src/CoreBundle/Entity/SequenceValid.php @@ -8,29 +8,21 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="sequence_valid") - * @ORM\Entity - */ +#[ORM\Table(name: 'sequence_valid')] +#[ORM\Entity] class SequenceValid { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceVariable") - * @ORM\JoinColumn(name="sequence_variable_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceVariable::class)] + #[ORM\JoinColumn(name: 'sequence_variable_id', referencedColumnName: 'id')] protected ?SequenceVariable $variable = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceCondition") - * @ORM\JoinColumn(name="sequence_condition_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceCondition::class)] + #[ORM\JoinColumn(name: 'sequence_condition_id', referencedColumnName: 'id')] protected ?SequenceCondition $condition = null; /** @@ -48,9 +40,6 @@ class SequenceValid return $this->variable; } - /** - * @return SequenceValid - */ public function setVariable(?SequenceVariable $variable): self { $this->variable = $variable; @@ -63,9 +52,6 @@ class SequenceValid return $this->condition; } - /** - * @return SequenceValid - */ public function setCondition(?SequenceCondition $condition): self { $this->condition = $condition; diff --git a/src/CoreBundle/Entity/SequenceValue.php b/src/CoreBundle/Entity/SequenceValue.php index a640221203..65099b0f2d 100644 --- a/src/CoreBundle/Entity/SequenceValue.php +++ b/src/CoreBundle/Entity/SequenceValue.php @@ -12,71 +12,48 @@ use Doctrine\ORM\Mapping as ORM; /** * Class Sequence. - * - * @ORM\Table(name="sequence_value") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_value')] +#[ORM\Entity] class SequenceValue { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sequenceValues") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'sequenceValues')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SequenceRowEntity") - * @ORM\JoinColumn(name="sequence_row_entity_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SequenceRowEntity::class)] + #[ORM\JoinColumn(name: 'sequence_row_entity_id', referencedColumnName: 'id')] protected ?SequenceRowEntity $entity = null; - /** - * @ORM\Column(name="advance", type="float") - */ + #[ORM\Column(name: 'advance', type: 'float')] protected int $advance; - /** - * @ORM\Column(name="complete_items", type="integer") - */ + #[ORM\Column(name: 'complete_items', type: 'integer')] protected int $completeItems; - /** - * @ORM\Column(name="total_items", type="integer") - */ + #[ORM\Column(name: 'total_items', type: 'integer')] protected int $totalItems; - /** - * @ORM\Column(name="success", type="boolean") - */ + #[ORM\Column(name: 'success', type: 'boolean')] protected int $success; - /** - * @ORM\Column(name="success_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'success_date', type: 'datetime', nullable: true)] protected ?DateTime $successDate = null; - /** - * @ORM\Column(name="available", type="boolean") - */ + #[ORM\Column(name: 'available', type: 'boolean')] protected int $available; - /** - * @ORM\Column(name="available_start_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'available_start_date', type: 'datetime', nullable: true)] protected ?DateTime $availableStartDate = null; - /** - * @ORM\Column(name="available_end_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'available_end_date', type: 'datetime', nullable: true)] protected ?DateTime $availableEndDate = null; /** @@ -94,9 +71,6 @@ class SequenceValue return $this->entity; } - /** - * @return SequenceValue - */ public function setEntity(?SequenceRowEntity $entity): self { $this->entity = $entity; @@ -130,9 +104,6 @@ class SequenceValue return $this->completeItems; } - /** - * @return SequenceValue - */ public function setCompleteItems(int $completeItems): self { $this->completeItems = $completeItems; @@ -148,9 +119,6 @@ class SequenceValue return $this->totalItems; } - /** - * @return SequenceValue - */ public function setTotalItems(int $totalItems): self { $this->totalItems = $totalItems; @@ -166,9 +134,6 @@ class SequenceValue return $this->success; } - /** - * @return SequenceValue - */ public function setSuccess(int $success): self { $this->success = $success; @@ -184,9 +149,6 @@ class SequenceValue return $this->successDate; } - /** - * @return SequenceValue - */ public function setSuccessDate(DateTime $successDate): self { $this->successDate = $successDate; @@ -202,9 +164,6 @@ class SequenceValue return $this->available; } - /** - * @return SequenceValue - */ public function setAvailable(int $available): self { $this->available = $available; @@ -220,9 +179,6 @@ class SequenceValue return $this->availableStartDate; } - /** - * @return SequenceValue - */ public function setAvailableStartDate(DateTime $availableStartDate): self { $this->availableStartDate = $availableStartDate; @@ -238,9 +194,6 @@ class SequenceValue return $this->availableEndDate; } - /** - * @return SequenceValue - */ public function setAvailableEndDate(DateTime $availableEndDate): self { $this->availableEndDate = $availableEndDate; diff --git a/src/CoreBundle/Entity/SequenceVariable.php b/src/CoreBundle/Entity/SequenceVariable.php index 9ed7739e2c..608d17951e 100644 --- a/src/CoreBundle/Entity/SequenceVariable.php +++ b/src/CoreBundle/Entity/SequenceVariable.php @@ -11,33 +11,24 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class SequenceVariable. - * - * @ORM\Table(name="sequence_variable") - * @ORM\Entity */ +#[ORM\Table(name: 'sequence_variable')] +#[ORM\Entity] class SequenceVariable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", nullable=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', nullable: true)] protected ?string $name = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="default_val", type="string", nullable=true) - */ + #[ORM\Column(name: 'default_val', type: 'string', nullable: true)] protected ?string $defaultValue = null; /** @@ -58,9 +49,6 @@ class SequenceVariable return $this->name; } - /** - * @return SequenceVariable - */ public function setName(string $name): self { $this->name = $name; @@ -76,9 +64,6 @@ class SequenceVariable return $this->defaultValue; } - /** - * @return SequenceVariable - */ public function setDefaultValue(string $defaultValue): self { $this->defaultValue = $defaultValue; @@ -94,9 +79,6 @@ class SequenceVariable return $this->description; } - /** - * @return SequenceVariable - */ public function setDescription(string $description): self { $this->description = $description; diff --git a/src/CoreBundle/Entity/Session.php b/src/CoreBundle/Entity/Session.php index 584d456ca1..fdfd86b8c2 100644 --- a/src/CoreBundle/Entity/Session.php +++ b/src/CoreBundle/Entity/Session.php @@ -11,6 +11,8 @@ use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Serializer\Filter\PropertyFilter; +use Chamilo\CoreBundle\Entity\Listener\SessionListener; +use Chamilo\CoreBundle\Repository\SessionRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -20,17 +22,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="session", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="name", columns={"name"}) - * } - * ) - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\SessionListener"}) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\SessionRepository") - * @UniqueEntity("name") - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -61,8 +52,13 @@ use Symfony\Component\Validator\Constraints as Assert; #[ApiFilter(SearchFilter::class, properties: ['name' => 'partial'])] #[ApiFilter(PropertyFilter::class)] #[ApiFilter(OrderFilter::class, properties: ['id', 'name'])] +#[ORM\Table(name: 'session')] +#[ORM\UniqueConstraint(name: 'name', columns: ['name'])] +#[ORM\EntityListeners([SessionListener::class])] +#[ORM\Entity(repositoryClass: SessionRepository::class)] +#[UniqueEntity('name')] -class Session implements ResourceWithAccessUrlInterface +class Session implements ResourceWithAccessUrlInterface, \Stringable { public const VISIBLE = 1; public const READ_ONLY = 2; @@ -75,11 +71,6 @@ class Session implements ResourceWithAccessUrlInterface public const GENERAL_COACH = 3; public const SESSION_ADMIN = 4; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups([ 'session:read', 'session_rel_user:read', @@ -87,76 +78,61 @@ class Session implements ResourceWithAccessUrlInterface 'course:read', 'track_e_exercise:read', ])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; /** * @var Collection - * - * @ORM\OrderBy({"position"="ASC"}) - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourse", mappedBy="session", cascade={"persist"}, orphanRemoval=true) */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\OrderBy(['position' => 'ASC'])] + #[ORM\OneToMany(targetEntity: SessionRelCourse::class, mappedBy: 'session', cascade: ['persist'], orphanRemoval: true)] protected Collection $courses; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionRelUser", mappedBy="session", cascade={"persist", "remove"}, orphanRemoval=true) */ #[Groups(['session:read'])] + #[ORM\OneToMany(targetEntity: SessionRelUser::class, mappedBy: 'session', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $users; /** * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser", - * mappedBy="session", - * cascade={"persist"}, - * orphanRemoval=true - * ) */ #[Groups(['session:read', 'session_rel_course_rel_user:read'])] + #[ORM\OneToMany(targetEntity: SessionRelCourseRelUser::class, mappedBy: 'session', cascade: ['persist'], orphanRemoval: true)] protected Collection $sessionRelCourseRelUsers; /** * @var Collection - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelCourse", mappedBy="session", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: SkillRelCourse::class, mappedBy: 'session', cascade: ['persist', 'remove'])] protected Collection $skills; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", mappedBy="session", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: SkillRelUser::class, mappedBy: 'session', cascade: ['persist'])] protected Collection $issuedSkills; /** * @var AccessUrlRelSession[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelSession", - * mappedBy="session", - * cascade={"persist"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: AccessUrlRelSession::class, mappedBy: 'session', cascade: ['persist'], orphanRemoval: true)] protected Collection $urls; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceLink", mappedBy="session", cascade={"remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: ResourceLink::class, mappedBy: 'session', cascade: ['remove'], orphanRemoval: true)] protected Collection $resourceLinks; protected AccessUrl $currentUrl; protected ?Course $currentCourse = null; - /** - * @ORM\Column(name="name", type="string", length=150) - */ #[Assert\NotBlank] #[Groups([ 'session:read', @@ -166,113 +142,78 @@ class Session implements ResourceWithAccessUrlInterface 'session_rel_user:read', 'course:read', ])] + #[ORM\Column(name: 'name', type: 'string', length: 150)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true, unique=false) - */ #[Groups(['session:read', 'session:write'])] + #[ORM\Column(name: 'description', type: 'text', nullable: true, unique: false)] protected ?string $description; - /** - * @ORM\Column(name="show_description", type="boolean", nullable=true) - */ #[Groups(['session:read', 'session:write'])] + #[ORM\Column(name: 'show_description', type: 'boolean', nullable: true)] protected ?bool $showDescription; - /** - * @ORM\Column(name="duration", type="integer", nullable=true) - */ #[Groups(['session:read', 'session:write'])] + #[ORM\Column(name: 'duration', type: 'integer', nullable: true)] protected ?int $duration = null; - /** - * @ORM\Column(name="nbr_courses", type="integer", nullable=false, unique=false) - */ #[Groups(['session:read'])] + #[ORM\Column(name: 'nbr_courses', type: 'integer', nullable: false, unique: false)] protected int $nbrCourses; - /** - * @ORM\Column(name="nbr_users", type="integer", nullable=false, unique=false) - */ #[Groups(['session:read'])] + #[ORM\Column(name: 'nbr_users', type: 'integer', nullable: false, unique: false)] protected int $nbrUsers; - /** - * @ORM\Column(name="nbr_classes", type="integer", nullable=false, unique=false) - */ #[Groups(['session:read'])] + #[ORM\Column(name: 'nbr_classes', type: 'integer', nullable: false, unique: false)] protected int $nbrClasses; - /** - * @ORM\Column(name="visibility", type="integer") - */ #[Groups(['session:read', 'session:write'])] + #[ORM\Column(name: 'visibility', type: 'integer')] protected int $visibility; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Promotion", inversedBy="sessions", cascade={"persist"}) - * @ORM\JoinColumn(name="promotion_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Promotion::class, inversedBy: 'sessions', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'promotion_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Promotion $promotion = null; - /** - * @ORM\Column(name="display_start_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'display_start_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $displayStartDate; - /** - * @ORM\Column(name="display_end_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'display_end_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $displayEndDate; - /** - * @ORM\Column(name="access_start_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'access_start_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $accessStartDate; - /** - * @ORM\Column(name="access_end_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'access_end_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $accessEndDate; - /** - * @ORM\Column(name="coach_access_start_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'coach_access_start_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $coachAccessStartDate; - /** - * @ORM\Column(name="coach_access_end_date", type="datetime", nullable=true, unique=false) - */ #[Groups(['session:read', 'session_rel_user:read', 'session_rel_course_rel_user:read'])] + #[ORM\Column(name: 'coach_access_end_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $coachAccessEndDate; - /** - * @ORM\Column(name="position", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: false, options: ['default' => 0])] protected int $position; - /** - * @ORM\Column(name="status", type="integer", nullable=false) - */ #[Groups(['session:read'])] + #[ORM\Column(name: 'status', type: 'integer', nullable: false)] protected int $status; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SessionCategory", inversedBy="sessions") - * @ORM\JoinColumn(name="session_category_id", referencedColumnName="id") - */ #[Groups(['session:read', 'session:write', 'session_rel_user:read'])] + #[ORM\ManyToOne(targetEntity: SessionCategory::class, inversedBy: 'sessions')] + #[ORM\JoinColumn(name: 'session_category_id', referencedColumnName: 'id')] protected ?SessionCategory $category = null; - /** - * @ORM\Column(name="send_subscription_notification", type="boolean", nullable=false, options={"default":false}) - */ + #[ORM\Column(name: 'send_subscription_notification', type: 'boolean', nullable: false, options: ['default' => false])] protected bool $sendSubscriptionNotification; public function __construct() @@ -747,9 +688,7 @@ class Session implements ResourceWithAccessUrlInterface { return $this ->getGeneralCoachesSubscriptions() - ->map(function (SessionRelUser $subscription) { - return $subscription->getUser(); - }) + ->map(fn (SessionRelUser $subscription) => $subscription->getUser()) ; } @@ -886,7 +825,7 @@ class Session implements ResourceWithAccessUrlInterface /** * @return SessionRelCourseRelUser[]|ArrayCollection|Collection */ - public function getSessionRelCourseRelUsers() + public function getSessionRelCourseRelUsers(): array|\Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->sessionRelCourseRelUsers; } @@ -909,10 +848,7 @@ class Session implements ResourceWithAccessUrlInterface } } - /** - * @return null|SessionRelCourse - */ - public function getCourseSubscription(Course $course) + public function getCourseSubscription(Course $course): ?SessionRelCourse { $criteria = Criteria::create()->where( Criteria::expr()->eq('course', $course) @@ -978,10 +914,8 @@ class Session implements ResourceWithAccessUrlInterface { // If the session is registered in the course session list. $exists = $this->getCourses()->exists( - function ($key, $element) use ($course) { - /** @var SessionRelCourse $element */ - return $course->getId() === $element->getCourse()->getId(); - } + fn ($key, $element) => /** @var SessionRelCourse $element */ +$course->getId() === $element->getCourse()->getId() ); if ($exists) { @@ -1008,7 +942,7 @@ class Session implements ResourceWithAccessUrlInterface * * @return ArrayCollection|Collection */ - public function getSessionRelCourseRelUsersByStatus(Course $course, int $status) + public function getSessionRelCourseRelUsersByStatus(Course $course, int $status): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { $criteria = Criteria::create() ->where( @@ -1118,9 +1052,7 @@ class Session implements ResourceWithAccessUrlInterface { return $this ->getGeneralAdminsSubscriptions() - ->map(function (SessionRelUser $subscription) { - return $subscription->getUser(); - }) + ->map(fn (SessionRelUser $subscription) => $subscription->getUser()) ; } @@ -1157,7 +1089,7 @@ class Session implements ResourceWithAccessUrlInterface /** * @return SkillRelCourse[]|Collection */ - public function getSkills() + public function getSkills(): array|\Doctrine\Common\Collections\Collection { return $this->skills; } @@ -1165,7 +1097,7 @@ class Session implements ResourceWithAccessUrlInterface /** * @return ResourceLink[]|Collection */ - public function getResourceLinks() + public function getResourceLinks(): array|\Doctrine\Common\Collections\Collection { return $this->resourceLinks; } diff --git a/src/CoreBundle/Entity/SessionCategory.php b/src/CoreBundle/Entity/SessionCategory.php index a983e10ad3..b4fc914c17 100644 --- a/src/CoreBundle/Entity/SessionCategory.php +++ b/src/CoreBundle/Entity/SessionCategory.php @@ -14,10 +14,6 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="session_category") - * @ORM\Entity - */ #[ApiResource( attributes: [ 'security' => "is_granted('ROLE_USER')", @@ -37,42 +33,32 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['session_category:write'], ], )] -class SessionCategory +#[ORM\Table(name: 'session_category')] +#[ORM\Entity] +class SessionCategory implements \Stringable { - /** - * @ORM\Column(name="id", type="integer", nullable=false) - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['session_category:read', 'session_rel_user:read'])] + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="sessionCategories", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: AccessUrl::class, inversedBy: 'sessionCategories', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id')] protected AccessUrl $url; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="category") - */ + #[ORM\OneToMany(targetEntity: Session::class, mappedBy: 'category')] protected Collection $sessions; - /** - * @ORM\Column(name="name", type="string", length=100, nullable=false, unique=false) - */ #[Groups(['session_category:read', 'session_category:write', 'session:read', 'session_rel_user:read'])] #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 100, nullable: false, unique: false)] protected string $name; - /** - * @ORM\Column(name="date_start", type="date", nullable=true, unique=false) - */ + #[ORM\Column(name: 'date_start', type: 'date', nullable: true, unique: false)] protected ?DateTime $dateStart = null; - /** - * @ORM\Column(name="date_end", type="date", nullable=true, unique=false) - */ + #[ORM\Column(name: 'date_end', type: 'date', nullable: true, unique: false)] protected ?DateTime $dateEnd = null; public function __construct() diff --git a/src/CoreBundle/Entity/SessionRelCourse.php b/src/CoreBundle/Entity/SessionRelCourse.php index 99e4576c00..ca8661ecdd 100644 --- a/src/CoreBundle/Entity/SessionRelCourse.php +++ b/src/CoreBundle/Entity/SessionRelCourse.php @@ -13,21 +13,6 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * Course subscriptions to a session. - * - * @ORM\Table(name="session_rel_course", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="course_session_unique", - * columns={"session_id", "c_id"}) - * }, - * indexes={ - * @ORM\Index(name="idx_session_rel_course_course_id", columns={"c_id"}) - * } - * ) - * @ORM\Entity - * @UniqueEntity( - * fields={"course", "session"}, - * message="The course is already registered in this session." - * ) */ #[ApiResource( collectionOperations: [ @@ -53,37 +38,32 @@ use Symfony\Component\Serializer\Annotation\Groups; 'groups' => ['session_rel_course:read'], ], )] +#[ORM\Table(name: 'session_rel_course')] +#[ORM\Index(name: 'idx_session_rel_course_course_id', columns: ['c_id'])] +#[ORM\UniqueConstraint(name: 'course_session_unique', columns: ['session_id', 'c_id'])] +#[ORM\Entity] +#[UniqueEntity(fields: ['course', 'session'], message: 'The course is already registered in this session.')] class SessionRelCourse { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="courses", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=false) - */ #[Groups(['session_rel_course:read', 'session_rel_course:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'courses', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: false)] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="sessions", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) - */ #[Groups(['session_rel_course:read', 'session_rel_course:write', 'session:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'sessions', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)] protected ?Course $course = null; - /** - * @ORM\Column(name="position", type="integer", nullable=false) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: false)] protected int $position; - /** - * @ORM\Column(name="nbr_users", type="integer") - */ + #[ORM\Column(name: 'nbr_users', type: 'integer')] protected int $nbrUsers; public function __construct() diff --git a/src/CoreBundle/Entity/SessionRelCourseRelUser.php b/src/CoreBundle/Entity/SessionRelCourseRelUser.php index 80e0bd0010..7da4758044 100644 --- a/src/CoreBundle/Entity/SessionRelCourseRelUser.php +++ b/src/CoreBundle/Entity/SessionRelCourseRelUser.php @@ -18,19 +18,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * User subscriptions to a session course. - * - * @ORM\Table( - * name="session_rel_course_rel_user", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="course_session_unique", - * columns={"session_id", "c_id", "user_id", "status"}) - * }, - * indexes={ - * @ORM\Index(name="idx_session_rel_course_rel_user_id_user", columns={"user_id"}), - * @ORM\Index(name="idx_session_rel_course_rel_user_course_id", columns={"c_id"}) - * } - * ) - * @ORM\Entity */ #[ApiResource( normalizationContext: [ @@ -55,6 +42,11 @@ use Symfony\Component\Validator\Constraints as Assert; 'session.coachAccessEndDate' => null, ] )] +#[ORM\Table(name: 'session_rel_course_rel_user')] +#[ORM\Index(name: 'idx_session_rel_course_rel_user_id_user', columns: ['user_id'])] +#[ORM\Index(name: 'idx_session_rel_course_rel_user_course_id', columns: ['c_id'])] +#[ORM\UniqueConstraint(name: 'course_session_unique', columns: ['session_id', 'c_id', 'user_id', 'status'])] +#[ORM\Entity] class SessionRelCourseRelUser { use UserTrait; @@ -67,59 +59,38 @@ class SessionRelCourseRelUser Session::COURSE_COACH => 'course_coach', ]; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sessionRelCourseRelUsers", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) - */ #[Groups(['session:read', 'session_rel_course_rel_user:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'sessionRelCourseRelUsers', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="sessionRelCourseRelUsers", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=false) - */ #[Groups(['session_rel_course_rel_user:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'sessionRelCourseRelUsers', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: false)] protected Session $session; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="sessionRelCourseRelUsers", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ #[Groups(['session:read', 'session_rel_course_rel_user:read', 'session_rel_user:read'])] #[MaxDepth(1)] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'sessionRelCourseRelUsers', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\Column(name="status", type="integer") - */ + #[ORM\Column(name: 'status', type: 'integer')] protected int $status; - /** - * @ORM\Column(name="visibility", type="integer") - */ + #[ORM\Column(name: 'visibility', type: 'integer')] protected int $visibility; - /** - * @ORM\Column(name="legal_agreement", type="integer", nullable=false, unique=false) - */ + #[ORM\Column(name: 'legal_agreement', type: 'integer', nullable: false, unique: false)] protected int $legalAgreement; - /** - * @Assert\Range( - * min = 0, - * max = 100, - * notInRangeMessage = "Progress from {{ min }} to {{ max }} only", - * ) - * - * @ORM\Column(name="progress", type="integer") - */ + #[Assert\Range(min: 0, max: 100, notInRangeMessage: 'Progress from {{ min }} to {{ max }} only')] + #[ORM\Column(name: 'progress', type: 'integer')] protected int $progress; public function __construct() diff --git a/src/CoreBundle/Entity/SessionRelUser.php b/src/CoreBundle/Entity/SessionRelUser.php index af9d105259..0f6c5a2864 100644 --- a/src/CoreBundle/Entity/SessionRelUser.php +++ b/src/CoreBundle/Entity/SessionRelUser.php @@ -20,22 +20,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * User subscriptions to a session. See also SessionRelCourseRelUser.php for a more detail subscription by course. - * - * @ORM\Table( - * name="session_rel_user", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="session_user_unique", - * columns={"session_id", "user_id", "relation_type"}) - * }, - * indexes={ - * @ORM\Index(name="idx_session_rel_user_id_user_moved", columns={"user_id", "moved_to"}) - * } - * ) - * @ORM\Entity - * @UniqueEntity( - * fields={"session", "user", "relationType"}, - * message="The user-course-relationType is already registered in this session." - * ) */ #[ApiResource( collectionOperations: [ @@ -70,62 +54,49 @@ use Symfony\Component\Validator\Constraints as Assert; 'session.coachAccessEndDate' => null, ] )] +#[ORM\Table(name: 'session_rel_user')] +#[ORM\Index(name: 'idx_session_rel_user_id_user_moved', columns: ['user_id', 'moved_to'])] +#[ORM\UniqueConstraint(name: 'session_user_unique', columns: ['session_id', 'user_id', 'relation_type'])] +#[ORM\Entity] +#[UniqueEntity(fields: ['session', 'user', 'relationType'], message: 'The user-course-relationType is already registered in this session.')] class SessionRelUser { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="users", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id") - */ #[Assert\NotNull] #[Groups(['session_rel_user:read'])] - protected ?Session $session; + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'users', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id')] + protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sessionsRelUser", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ #[Assert\NotNull] #[Groups(['session_rel_user:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'sessionsRelUser', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\Column(name="relation_type", type="integer") - */ #[Groups(['session_rel_user:read'])] #[Assert\Choice(callback: [Session::class, 'getRelationTypeList'], message: 'Choose a valid relation type.')] + #[ORM\Column(name: 'relation_type', type: 'integer')] protected int $relationType; - /** - * @ORM\Column(name="duration", type="integer", nullable=false) - */ #[Groups(['session_rel_user:read'])] + #[ORM\Column(name: 'duration', type: 'integer', nullable: false)] protected int $duration; - /** - * @ORM\Column(name="moved_to", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'moved_to', type: 'integer', nullable: true, unique: false)] protected ?int $movedTo; - /** - * @ORM\Column(name="moved_status", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'moved_status', type: 'integer', nullable: true, unique: false)] protected ?int $movedStatus; - /** - * @ORM\Column(name="moved_at", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'moved_at', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $movedAt = null; - /** - * @ORM\Column(name="registered_at", type="datetime") - */ + #[ORM\Column(name: 'registered_at', type: 'datetime')] protected DateTime $registeredAt; #[Groups(['session_rel_user:read'])] diff --git a/src/CoreBundle/Entity/SettingsCurrent.php b/src/CoreBundle/Entity/SettingsCurrent.php index 28440b11fa..8a37416cbf 100644 --- a/src/CoreBundle/Entity/SettingsCurrent.php +++ b/src/CoreBundle/Entity/SettingsCurrent.php @@ -11,93 +11,57 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Platform settings. - * - * @ORM\Table( - * name="settings_current", - * options={"row_format"="DYNAMIC"}, - * uniqueConstraints={ - * @ORM\UniqueConstraint( - * name="unique_setting", - * columns={"variable", "subkey", "access_url"}) - * }, - * indexes={ - * @ORM\Index(name="access_url", columns={"access_url"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'settings_current', options: ['row_format' => 'DYNAMIC'])] +#[ORM\Index(name: 'access_url', columns: ['access_url'])] +#[ORM\UniqueConstraint(name: 'unique_setting', columns: ['variable', 'subkey', 'access_url'])] +#[ORM\Entity] class SettingsCurrent { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="settings", cascade={"persist"}) - * @ORM\JoinColumn(name="access_url", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrl::class, inversedBy: 'settings', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'access_url', referencedColumnName: 'id')] protected AccessUrl $url; - /** - * @ORM\Column(name="variable", type="string", length=190, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'variable', type: 'string', length: 190, nullable: false)] protected string $variable; - /** - * @ORM\Column(name="subkey", type="string", length=190, nullable=true) - */ + #[ORM\Column(name: 'subkey', type: 'string', length: 190, nullable: true)] protected ?string $subkey = null; - /** - * @ORM\Column(name="type", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: true)] protected ?string $type = null; - /** - * @ORM\Column(name="category", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'category', type: 'string', length: 255, nullable: true)] protected ?string $category = null; - /** - * @ORM\Column(name="selected_value", type="text", nullable=true) - */ + #[ORM\Column(name: 'selected_value', type: 'text', nullable: true)] protected ?string $selectedValue = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="comment", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'string', length: 255, nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="scope", type="string", length=50, nullable=true) - */ + #[ORM\Column(name: 'scope', type: 'string', length: 50, nullable: true)] protected ?string $scope = null; - /** - * @ORM\Column(name="subkeytext", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'subkeytext', type: 'string', length: 255, nullable: true)] protected ?string $subkeytext = null; - /** - * @ORM\Column(name="access_url_changeable", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'access_url_changeable', type: 'integer', nullable: false)] protected int $accessUrlChangeable; - /** - * @ORM\Column(name="access_url_locked", type="integer", nullable=false, options={"default":0 }) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'access_url_locked', type: 'integer', nullable: false, options: ['default' => 0])] protected int $accessUrlLocked = 0; public function __construct() diff --git a/src/CoreBundle/Entity/SettingsOptions.php b/src/CoreBundle/Entity/SettingsOptions.php index 3c6647cec5..fd1630ea2e 100644 --- a/src/CoreBundle/Entity/SettingsOptions.php +++ b/src/CoreBundle/Entity/SettingsOptions.php @@ -10,38 +10,24 @@ use Doctrine\ORM\Mapping as ORM; /** * SettingsOptions. - * - * @ORM\Table( - * name="settings_options", - * options={"row_format"="DYNAMIC"}, - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="unique_setting_option", columns={"variable", "value"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'settings_options', options: ['row_format' => 'DYNAMIC'])] +#[ORM\UniqueConstraint(name: 'unique_setting_option', columns: ['variable', 'value'])] +#[ORM\Entity] class SettingsOptions { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="variable", type="string", length=190, nullable=false) - */ + #[ORM\Column(name: 'variable', type: 'string', length: 190, nullable: false)] protected string $variable; - /** - * @ORM\Column(name="value", type="string", length=190, nullable=true) - */ + #[ORM\Column(name: 'value', type: 'string', length: 190, nullable: true)] protected ?string $value = null; - /** - * @ORM\Column(name="display_text", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'display_text', type: 'string', length: 255, nullable: false)] protected string $displayText; public function setVariable(string $variable): self diff --git a/src/CoreBundle/Entity/Skill.php b/src/CoreBundle/Entity/Skill.php index 614fdeb233..972c53d6a8 100644 --- a/src/CoreBundle/Entity/Skill.php +++ b/src/CoreBundle/Entity/Skill.php @@ -15,10 +15,6 @@ use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="skill") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\SkillRepository") - */ #[ApiResource( attributes: [ 'security' => "is_granted('ROLE_ADMIN')", @@ -27,115 +23,86 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['skill:read'], ], )] -class Skill +#[ORM\Table(name: 'skill')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\SkillRepository::class)] +class Skill implements \Stringable { public const STATUS_DISABLED = 0; public const STATUS_ENABLED = 1; - /** - * @Groups({"skill:read"}) - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[Groups(['skill:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Profile", inversedBy="skills") - * @ORM\JoinColumn(name="profile_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Profile::class, inversedBy: 'skills')] + #[ORM\JoinColumn(name: 'profile_id', referencedColumnName: 'id')] protected ?Profile $profile = null; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", mappedBy="skill", cascade={"persist"}) - * * @var SkillRelUser[]|Collection */ + #[ORM\OneToMany(targetEntity: SkillRelUser::class, mappedBy: 'skill', cascade: ['persist'])] protected Collection $issuedSkills; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelItem", mappedBy="skill", cascade={"persist"}) - * * @var Collection|SkillRelItem[] */ + #[ORM\OneToMany(targetEntity: SkillRelItem::class, mappedBy: 'skill', cascade: ['persist'])] protected Collection $items; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelSkill", mappedBy="skill", cascade={"persist"}) - * * @var Collection|SkillRelSkill[] */ + #[ORM\OneToMany(targetEntity: SkillRelSkill::class, mappedBy: 'skill', cascade: ['persist'])] protected Collection $skills; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelCourse", mappedBy="skill", cascade={"persist"}) - * * @var Collection|SkillRelCourse[] */ + #[ORM\OneToMany(targetEntity: SkillRelCourse::class, mappedBy: 'skill', cascade: ['persist'])] protected Collection $courses; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelGradebook", mappedBy="skill", cascade={"persist"}) - * * @var Collection|SkillRelGradebook[] */ + #[ORM\OneToMany(targetEntity: SkillRelGradebook::class, mappedBy: 'skill', cascade: ['persist'])] protected Collection $gradeBookCategories; - /** - * @Groups({"skill:read", "skill:write"}) - * - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[Groups(['skill:read', 'skill:write'])] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @Groups({"skill:read", "skill:write"}) - * - * @ORM\Column(name="short_code", type="string", length=100, nullable=false) - */ #[Assert\NotBlank] + #[Groups(['skill:read', 'skill:write'])] + #[ORM\Column(name: 'short_code', type: 'string', length: 100, nullable: false)] protected string $shortCode; - /** - * @Groups({"skill:read", "skill:write"}) - * - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[Groups(['skill:read', 'skill:write'])] + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; - /** - * @ORM\Column(name="access_url_id", type="integer", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'access_url_id', type: 'integer', nullable: false)] protected int $accessUrlId; - /** - * @ORM\Column(name="icon", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'icon', type: 'string', length: 255, nullable: false)] protected string $icon; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"persist", "remove"}) - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Asset::class, cascade: ['persist', 'remove'])] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id')] protected ?Asset $asset = null; - /** - * @ORM\Column(name="criteria", type="text", nullable=true) - */ + #[ORM\Column(name: 'criteria', type: 'text', nullable: true)] protected ?string $criteria = null; - /** - * @ORM\Column(name="status", type="integer", nullable=false, options={"default":1}) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: false, options: ['default' => 1])] protected int $status; - /** - * @Gedmo\Timestampable(on="update") - * - * @ORM\Column(name="updated_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'updated_at', type: 'datetime', nullable: false)] protected DateTime $updatedAt; public function __construct() @@ -381,17 +348,15 @@ class Skill /** * @return SkillRelSkill[]|Collection */ - public function getSkills() + public function getSkills(): array|\Doctrine\Common\Collections\Collection { return $this->skills; } /** * @param SkillRelSkill[]|Collection $skills - * - * @return Skill */ - public function setSkills($skills): self + public function setSkills(array|\Doctrine\Common\Collections\Collection $skills): self { $this->skills = $skills; @@ -401,17 +366,15 @@ class Skill /** * @return SkillRelGradebook[]|Collection */ - public function getGradeBookCategories() + public function getGradeBookCategories(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookCategories; } /** * @param SkillRelGradebook[]|Collection $gradeBookCategories - * - * @return Skill */ - public function setGradeBookCategories($gradeBookCategories): self + public function setGradeBookCategories(array|\Doctrine\Common\Collections\Collection $gradeBookCategories): self { $this->gradeBookCategories = $gradeBookCategories; diff --git a/src/CoreBundle/Entity/SkillProfile.php b/src/CoreBundle/Entity/SkillProfile.php index c8584e7451..16acf9ccd3 100644 --- a/src/CoreBundle/Entity/SkillProfile.php +++ b/src/CoreBundle/Entity/SkillProfile.php @@ -9,28 +9,20 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="skill_profile") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_profile')] +#[ORM\Entity] class SkillProfile { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; public function setName(string $name): self diff --git a/src/CoreBundle/Entity/SkillRelCourse.php b/src/CoreBundle/Entity/SkillRelCourse.php index dd9b4fb5c9..efb40492c6 100644 --- a/src/CoreBundle/Entity/SkillRelCourse.php +++ b/src/CoreBundle/Entity/SkillRelCourse.php @@ -12,37 +12,28 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; /** * SkillRelCourse. - * - * @ORM\Table(name="skill_rel_course") - * @ORM\Entity */ +#[ORM\Table(name: 'skill_rel_course')] +#[ORM\Entity] class SkillRelCourse { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", inversedBy="courses") - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, inversedBy: 'courses')] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Skill $skill; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="skills", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'skills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="skills", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'skills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected ?Session $session = null; public function __construct() diff --git a/src/CoreBundle/Entity/SkillRelGradebook.php b/src/CoreBundle/Entity/SkillRelGradebook.php index 9d37468cc6..913bc06ffb 100644 --- a/src/CoreBundle/Entity/SkillRelGradebook.php +++ b/src/CoreBundle/Entity/SkillRelGradebook.php @@ -8,34 +8,24 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="skill_rel_gradebook") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_gradebook')] +#[ORM\Entity] class SkillRelGradebook { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", inversedBy="gradeBookCategories") - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, inversedBy: 'gradeBookCategories')] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Skill $skill; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", inversedBy="skills") - * @ORM\JoinColumn(name="gradebook_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\GradebookCategory::class, inversedBy: 'skills')] + #[ORM\JoinColumn(name: 'gradebook_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected GradebookCategory $gradeBookCategory; - /** - * @ORM\Column(name="type", type="string", length=10, nullable=false) - */ + #[ORM\Column(name: 'type', type: 'string', length: 10, nullable: false)] protected string $type; public function __construct() diff --git a/src/CoreBundle/Entity/SkillRelItem.php b/src/CoreBundle/Entity/SkillRelItem.php index fea459f056..833dd1eda9 100644 --- a/src/CoreBundle/Entity/SkillRelItem.php +++ b/src/CoreBundle/Entity/SkillRelItem.php @@ -10,82 +10,63 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="skill_rel_item") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_item')] +#[ORM\Entity] class SkillRelItem { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", inversedBy="items") - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, inversedBy: 'items')] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Skill $skill; /** * See ITEM_TYPE_* constants in api.lib.php. - * - * @ORM\Column(name="item_type", type="integer", nullable=false) */ + #[ORM\Column(name: 'item_type', type: 'integer', nullable: false)] protected int $itemType; /** * iid value. - * - * @ORM\Column(name="item_id", type="integer", nullable=false) */ + #[ORM\Column(name: 'item_id', type: 'integer', nullable: false)] protected int $itemId; /** * A text expressing what has to be achieved * (view, finish, get more than X score, finishing all children skills, etc),. - * - * @ORM\Column(name="obtain_conditions", type="string", length=255, nullable=true) */ + #[ORM\Column(name: 'obtain_conditions', type: 'string', length: 255, nullable: true)] protected ?string $obtainConditions = null; /** * if it requires validation by a teacher. - * - * @ORM\Column(name="requires_validation", type="boolean") */ + #[ORM\Column(name: 'requires_validation', type: 'boolean')] protected bool $requiresValidation; /** * Set to false if this is a children skill used only to obtain a higher-level skill, * so a skill with is_real = false never appears in a student portfolio/backpack. - * - * @ORM\Column(name="is_real", type="boolean") */ + #[ORM\Column(name: 'is_real', type: 'boolean')] protected bool $isReal; - /** - * @ORM\Column(name="c_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: true)] protected ?int $courseId = null; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; - /** - * @ORM\Column(name="created_by", type="integer", nullable=false) - */ + #[ORM\Column(name: 'created_by', type: 'integer', nullable: false)] protected int $createdBy; - /** - * @ORM\Column(name="updated_by", type="integer", nullable=false) - */ + #[ORM\Column(name: 'updated_by', type: 'integer', nullable: false)] protected int $updatedBy; public function __construct() @@ -287,16 +268,11 @@ class SkillRelItem public function getItemResultUrl(string $cidReq): string { $url = ''; - switch ($this->getItemType()) { - case ITEM_TYPE_EXERCISE: - $url = 'exercise/exercise_show.php?action=qualify&'.$cidReq; - - break; - case ITEM_TYPE_STUDENT_PUBLICATION: - $url = 'work/view.php?'.$cidReq; - - break; - } + $url = match ($this->getItemType()) { + ITEM_TYPE_EXERCISE => 'exercise/exercise_show.php?action=qualify&'.$cidReq, + ITEM_TYPE_STUDENT_PUBLICATION => 'work/view.php?'.$cidReq, + default => $url, + }; return $url; } @@ -304,16 +280,11 @@ class SkillRelItem public function getItemResultList(string $cidReq): string { $url = ''; - switch ($this->getItemType()) { - case ITEM_TYPE_EXERCISE: - $url = 'exercise/exercise_report.php?'.$cidReq.'&id='.$this->getItemId(); - - break; - case ITEM_TYPE_STUDENT_PUBLICATION: - $url = 'work/work_list_all.php?'.$cidReq.'&id='.$this->getItemId(); - - break; - } + $url = match ($this->getItemType()) { + ITEM_TYPE_EXERCISE => 'exercise/exercise_report.php?'.$cidReq.'&id='.$this->getItemId(), + ITEM_TYPE_STUDENT_PUBLICATION => 'work/work_list_all.php?'.$cidReq.'&id='.$this->getItemId(), + default => $url, + }; return $url; } diff --git a/src/CoreBundle/Entity/SkillRelItemRelUser.php b/src/CoreBundle/Entity/SkillRelItemRelUser.php index fadffcaa33..f9297f14be 100644 --- a/src/CoreBundle/Entity/SkillRelItemRelUser.php +++ b/src/CoreBundle/Entity/SkillRelItemRelUser.php @@ -11,49 +11,35 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="skill_rel_item_rel_user") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_item_rel_user')] +#[ORM\Entity] class SkillRelItemRelUser { use TimestampableEntity; use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SkillRelItem", cascade={"persist"}) - * @ORM\JoinColumn(name="skill_rel_item_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SkillRelItem::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'skill_rel_item_id', referencedColumnName: 'id', nullable: false)] protected SkillRelItem $skillRelItem; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] protected User $user; - /** - * @ORM\Column(name="result_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'result_id', type: 'integer', nullable: true)] protected int $resultId; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="created_by", type="integer", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_by', type: 'integer', nullable: false)] protected int $createdBy; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(name="updated_by", type="integer", nullable=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'updated_by', type: 'integer', nullable: false)] protected int $updatedBy; public function __construct() diff --git a/src/CoreBundle/Entity/SkillRelProfile.php b/src/CoreBundle/Entity/SkillRelProfile.php index 7237da4b52..da348d7238 100644 --- a/src/CoreBundle/Entity/SkillRelProfile.php +++ b/src/CoreBundle/Entity/SkillRelProfile.php @@ -8,29 +8,21 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="skill_rel_profile") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_profile')] +#[ORM\Entity] class SkillRelProfile { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", cascade={"persist"}) - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Skill $skill; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SkillProfile", cascade={"persist"}) - * @ORM\JoinColumn(name="profile_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SkillProfile::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'profile_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected SkillProfile $profile; /** diff --git a/src/CoreBundle/Entity/SkillRelSkill.php b/src/CoreBundle/Entity/SkillRelSkill.php index 2828d3f139..a8b95e2fbb 100644 --- a/src/CoreBundle/Entity/SkillRelSkill.php +++ b/src/CoreBundle/Entity/SkillRelSkill.php @@ -9,41 +9,29 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="skill_rel_skill") - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_skill')] +#[ORM\Entity] class SkillRelSkill { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", inversedBy="skills") - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, inversedBy: 'skills')] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id')] protected Skill $skill; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class)] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?Skill $parent = null; - /** - * @ORM\Column(name="relation_type", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'relation_type', type: 'integer', nullable: false)] protected int $relationType; - /** - * @ORM\Column(name="level", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'level', type: 'integer', nullable: false)] protected int $level; public function getParent(): ?Skill diff --git a/src/CoreBundle/Entity/SkillRelUser.php b/src/CoreBundle/Entity/SkillRelUser.php index b9e5f53e76..7688e20de0 100644 --- a/src/CoreBundle/Entity/SkillRelUser.php +++ b/src/CoreBundle/Entity/SkillRelUser.php @@ -14,98 +14,66 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="skill_rel_user", - * indexes={ - * @ORM\Index(name="idx_select_cs", columns={"course_id", "session_id"}), - * @ORM\Index(name="idx_select_s_c_u", columns={"session_id", "course_id", "user_id"}), - * @ORM\Index(name="idx_select_sk_u", columns={"skill_id", "user_id"}) - * } - * ) - * @ORM\Entity - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\SkillRelUserListener"}) - */ +#[ORM\Table(name: 'skill_rel_user')] +#[ORM\Index(name: 'idx_select_cs', columns: ['course_id', 'session_id'])] +#[ORM\Index(name: 'idx_select_s_c_u', columns: ['session_id', 'course_id', 'user_id'])] +#[ORM\Index(name: 'idx_select_sk_u', columns: ['skill_id', 'user_id'])] +#[ORM\Entity] +#[ORM\EntityListeners([\Chamilo\CoreBundle\Entity\Listener\SkillRelUserListener::class])] class SkillRelUser { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="achievedSkills", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'achievedSkills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Skill", inversedBy="issuedSkills", cascade={"persist"}) - * @ORM\JoinColumn(name="skill_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Skill::class, inversedBy: 'issuedSkills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected ?Skill $skill = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="issuedSkills", cascade={"persist"}) - * @ORM\JoinColumn(name="course_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'issuedSkills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Course $course = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="issuedSkills", cascade={"persist"}) - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'issuedSkills', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Session $session = null; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SkillRelUserComment", mappedBy="skillRelUser", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) - * * @var Collection|SkillRelUserComment[] */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\SkillRelUserComment::class, mappedBy: 'skillRelUser', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $comments; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Level") - * @ORM\JoinColumn(name="acquired_level", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Level::class)] + #[ORM\JoinColumn(name: 'acquired_level', referencedColumnName: 'id')] protected ?Level $acquiredLevel = null; - /** - * @ORM\Column(name="acquired_skill_at", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'acquired_skill_at', type: 'datetime', nullable: false)] protected DateTime $acquiredSkillAt; /** * Whether this has been confirmed by a teacher or not * Only set to 0 when the skill_rel_item says requires_validation = 1. - * - * @ORM\Column(name="validation_status", type="integer") */ + #[ORM\Column(name: 'validation_status', type: 'integer')] protected int $validationStatus; - /** - * @ORM\Column(name="assigned_by", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'assigned_by', type: 'integer', nullable: false)] protected int $assignedBy; - /** - * @ORM\Column(name="argumentation", type="text") - */ #[Assert\NotBlank] + #[ORM\Column(name: 'argumentation', type: 'text')] protected string $argumentation; - /** - * @ORM\Column(name="argumentation_author_id", type="integer") - */ + #[ORM\Column(name: 'argumentation_author_id', type: 'integer')] protected int $argumentationAuthorId; public function __construct() diff --git a/src/CoreBundle/Entity/SkillRelUserComment.php b/src/CoreBundle/Entity/SkillRelUserComment.php index 999432c13d..e235941adc 100644 --- a/src/CoreBundle/Entity/SkillRelUserComment.php +++ b/src/CoreBundle/Entity/SkillRelUserComment.php @@ -9,49 +9,31 @@ namespace Chamilo\CoreBundle\Entity; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="skill_rel_user_comment", - * indexes={ - * @ORM\Index(name="idx_select_su_giver", columns={"skill_rel_user_id", "feedback_giver_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'skill_rel_user_comment')] +#[ORM\Index(name: 'idx_select_su_giver', columns: ['skill_rel_user_id', 'feedback_giver_id'])] +#[ORM\Entity] class SkillRelUserComment { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", inversedBy="comments") - * @ORM\JoinColumn(name="skill_rel_user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SkillRelUser::class, inversedBy: 'comments')] + #[ORM\JoinColumn(name: 'skill_rel_user_id', referencedColumnName: 'id')] protected ?SkillRelUser $skillRelUser = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="commentedUserSkills") - * @ORM\JoinColumn(name="feedback_giver_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'commentedUserSkills')] + #[ORM\JoinColumn(name: 'feedback_giver_id', referencedColumnName: 'id')] protected ?User $feedbackGiver = null; - /** - * @ORM\Column(name="feedback_text", type="text") - */ + #[ORM\Column(name: 'feedback_text', type: 'text')] protected string $feedbackText; - /** - * @ORM\Column(name="feedback_value", type="integer", nullable=true, options={"default":1}) - */ - protected ?int $feedbackValue; + #[ORM\Column(name: 'feedback_value', type: 'integer', nullable: true, options: ['default' => 1])] + protected ?int $feedbackValue = null; - /** - * @ORM\Column(name="feedback_datetime", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'feedback_datetime', type: 'datetime', nullable: false)] protected DateTime $feedbackDateTime; /** diff --git a/src/CoreBundle/Entity/SocialPost.php b/src/CoreBundle/Entity/SocialPost.php index 83cf4bf2ef..48bca81afd 100644 --- a/src/CoreBundle/Entity/SocialPost.php +++ b/src/CoreBundle/Entity/SocialPost.php @@ -24,15 +24,6 @@ use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="social_post", indexes={ - * @ORM\Index(name="idx_social_post_sender", columns={"sender_id"}), - * @ORM\Index(name="idx_social_post_user", columns={"user_receiver_id"}), - * @ORM\Index(name="idx_social_post_group", columns={"group_receiver_id"}), - * @ORM\Index(name="idx_social_post_type", columns={"type"}) - * }) - * @ORM\Entity(repositoryClass=SocialPostRepository::class) - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -81,6 +72,12 @@ use Symfony\Component\Validator\Constraints as Assert; )] #[ApiFilter(SearchFilter::class, properties: ['parent' => SearchFilterInterface::STRATEGY_EXACT])] #[ApiFilter(OrderFilter::class, properties: ['sendDate'])] +#[ORM\Table(name: 'social_post')] +#[ORM\Index(name: 'idx_social_post_sender', columns: ['sender_id'])] +#[ORM\Index(name: 'idx_social_post_user', columns: ['user_receiver_id'])] +#[ORM\Index(name: 'idx_social_post_group', columns: ['group_receiver_id'])] +#[ORM\Index(name: 'idx_social_post_type', columns: ['type'])] +#[ORM\Entity(repositoryClass: SocialPostRepository::class)] class SocialPost { public const TYPE_WALL_POST = 1; @@ -91,96 +88,59 @@ class SocialPost public const STATUS_SENT = 1; public const STATUS_DELETED = 2; - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(name="id", type="bigint") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(name: 'id', type: 'bigint')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="sentSocialPosts") - * @ORM\JoinColumn(nullable=false) - */ #[Groups(['social_post:read', 'social_post:write'])] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'sentSocialPosts')] + #[ORM\JoinColumn(nullable: false)] protected User $sender; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="receivedSocialPosts") - * @ORM\JoinColumn(nullable=true) - */ #[Groups(['social_post:read', 'social_post:write'])] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'receivedSocialPosts')] + #[ORM\JoinColumn(nullable: true)] protected ?User $userReceiver; - /** - * @ORM\Column(name="subject", type="text", nullable=true) - */ - protected ?string $subject; + #[ORM\Column(name: 'subject', type: 'text', nullable: true)] + protected ?string $subject = null; - /** - * @ORM\Column(type="text") - */ #[Groups(['social_post:read', 'social_post:write'])] + #[ORM\Column(type: 'text')] protected string $content; - /** - * @Assert\Choice({ - * SocialPost::TYPE_WALL_POST, - * SocialPost::TYPE_WALL_COMMENT, - * SocialPost::TYPE_GROUP_MESSAGE, - * SocialPost::TYPE_PROMOTED_MESSAGE, - * }, - * message="Choose a valid type." - * ) - * @ORM\Column(type="smallint") - */ #[Groups(['social_post:write', 'social_post:read'])] + #[Assert\Choice([SocialPost::TYPE_WALL_POST, SocialPost::TYPE_WALL_COMMENT, SocialPost::TYPE_GROUP_MESSAGE, SocialPost::TYPE_PROMOTED_MESSAGE], message: 'Choose a valid type.')] + #[ORM\Column(type: 'smallint')] protected int $type; - /** - * @Assert\Choice({ - * SocialPost::STATUS_SENT, - * SocialPost::STATUS_DELETED, - * }, message="Choose a status.") - * - * @ORM\Column(type="smallint") - */ + #[Assert\Choice([SocialPost::STATUS_SENT, SocialPost::STATUS_DELETED], message: 'Choose a status.')] + #[ORM\Column(type: 'smallint')] protected int $status; - /** - * @ORM\Column(type="datetime") - */ #[Groups(['social_post:read'])] + #[ORM\Column(type: 'datetime')] protected DateTime $sendDate; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected DateTime $updatedAt; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SocialPostFeedback", mappedBy="socialPost") - */ + #[ORM\OneToMany(targetEntity: SocialPostFeedback::class, mappedBy: 'socialPost')] protected Collection $feedbacks; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") - * @ORM\JoinColumn(onDelete="CASCADE") - */ #[Groups(['social_post:read', 'social_post:write'])] + #[ORM\ManyToOne(targetEntity: Usergroup::class)] + #[ORM\JoinColumn(onDelete: 'CASCADE')] protected ?Usergroup $groupReceiver = null; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SocialPost", mappedBy="parent") - */ + #[ORM\OneToMany(targetEntity: SocialPost::class, mappedBy: 'parent')] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SocialPost", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Groups(['social_post:write'])] + #[ORM\ManyToOne(targetEntity: SocialPost::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?SocialPost $parent; #[Groups(['social_post:read', 'social_post_feedback'])] diff --git a/src/CoreBundle/Entity/SocialPostFeedback.php b/src/CoreBundle/Entity/SocialPostFeedback.php index 6cf283bbcd..07b6c1ad92 100644 --- a/src/CoreBundle/Entity/SocialPostFeedback.php +++ b/src/CoreBundle/Entity/SocialPostFeedback.php @@ -12,53 +12,34 @@ use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping\Index; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table( - * name="social_post_feedback", - * indexes={ - * @Index(name="idx_social_post_uid_spid", columns={"social_post_id", "user_id"}) - * } - * ) - * @ORM\Entity() - */ +#[ORM\Table(name: 'social_post_feedback')] +#[Index(name: 'idx_social_post_uid_spid', columns: ['social_post_id', 'user_id'])] +#[ORM\Entity] class SocialPostFeedback { use UserTrait; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id() - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\SocialPost", inversedBy="feedbacks") - * @ORM\JoinColumn(name="social_post_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\SocialPost::class, inversedBy: 'feedbacks')] + #[ORM\JoinColumn(name: 'social_post_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected SocialPost $socialPost; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="socialPostsFeedbacks") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'socialPostsFeedbacks')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="liked", type="boolean", options={"default":false}) - */ + #[ORM\Column(name: 'liked', type: 'boolean', options: ['default' => false])] protected bool $liked; - /** - * @ORM\Column(name="disliked", type="boolean", options={"default":false}) - */ + #[ORM\Column(name: 'disliked', type: 'boolean', options: ['default' => false])] protected bool $disliked; - /** - * @Gedmo\Timestampable(on="update") - * - * @ORM\Column(name="updated_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'updated_at', type: 'datetime', nullable: false)] protected DateTime $updatedAt; public function __construct() diff --git a/src/CoreBundle/Entity/SpecificField.php b/src/CoreBundle/Entity/SpecificField.php index 5751a5ab63..93dbea6feb 100644 --- a/src/CoreBundle/Entity/SpecificField.php +++ b/src/CoreBundle/Entity/SpecificField.php @@ -10,31 +10,21 @@ use Doctrine\ORM\Mapping as ORM; /** * SpecificField. - * - * @ORM\Table( - * name="specific_field", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="unique_specific_field__code", columns={"code"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'specific_field')] +#[ORM\UniqueConstraint(name: 'unique_specific_field__code', columns: ['code'])] +#[ORM\Entity] class SpecificField { - /** - * @ORM\Column(name="code", type="string", length=1, nullable=false) - */ + #[ORM\Column(name: 'code', type: 'string', length: 1, nullable: false)] protected string $code; - /** - * @ORM\Column(name="name", type="string", length=200, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 200, nullable: false)] protected string $name; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; /** diff --git a/src/CoreBundle/Entity/SpecificFieldValues.php b/src/CoreBundle/Entity/SpecificFieldValues.php index bdc0cfaab0..24719f734a 100644 --- a/src/CoreBundle/Entity/SpecificFieldValues.php +++ b/src/CoreBundle/Entity/SpecificFieldValues.php @@ -10,42 +10,29 @@ use Doctrine\ORM\Mapping as ORM; /** * SpecificFieldValues. - * - * @ORM\Table(name="specific_field_values") - * @ORM\Entity */ +#[ORM\Table(name: 'specific_field_values')] +#[ORM\Entity] class SpecificFieldValues { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="course_code", type="string", length=40, nullable=false) - */ + #[ORM\Column(name: 'course_code', type: 'string', length: 40, nullable: false)] protected string $courseCode; - /** - * @ORM\Column(name="tool_id", type="string", length=100, nullable=false) - */ + #[ORM\Column(name: 'tool_id', type: 'string', length: 100, nullable: false)] protected string $toolId; - /** - * @ORM\Column(name="ref_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'ref_id', type: 'integer', nullable: false)] protected int $refId; - /** - * @ORM\Column(name="field_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'field_id', type: 'integer', nullable: false)] protected int $fieldId; - /** - * @ORM\Column(name="value", type="string", length=200, nullable=false) - */ + #[ORM\Column(name: 'value', type: 'string', length: 200, nullable: false)] protected string $value; /** diff --git a/src/CoreBundle/Entity/SysAnnouncement.php b/src/CoreBundle/Entity/SysAnnouncement.php index fc1f6537f8..f800828212 100644 --- a/src/CoreBundle/Entity/SysAnnouncement.php +++ b/src/CoreBundle/Entity/SysAnnouncement.php @@ -12,71 +12,52 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Portal announcements. - * - * @ORM\Table(name="sys_announcement") - * @ORM\Entity */ +#[ORM\Table(name: 'sys_announcement')] +#[ORM\Entity] class SysAnnouncement { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="date_start", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'date_start', type: 'datetime', nullable: false)] protected DateTime $dateStart; - /** - * @ORM\Column(name="date_end", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'date_end', type: 'datetime', nullable: false)] protected DateTime $dateEnd; - /** - * @ORM\Column(name="title", type="string", length=250, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'content', type: 'text', nullable: false)] protected string $content; - /** - * @ORM\Column(name="lang", type="string", length=70, nullable=true) - */ + #[ORM\Column(name: 'lang', type: 'string', length: 70, nullable: true)] protected ?string $lang = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl") - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrl::class)] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected AccessUrl $url; /** * An array of roles. Example: ROLE_USER, ROLE_TEACHER, ROLE_ADMIN. * - * @ORM\Column(type="array") * * @var string[] */ + #[ORM\Column(type: 'array')] protected array $roles = []; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Career") - * @ORM\JoinColumn(name="career_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Career::class)] + #[ORM\JoinColumn(name: 'career_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Career $career = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Promotion", inversedBy="announcements") - * @ORM\JoinColumn(name="promotion_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Promotion::class, inversedBy: 'announcements')] + #[ORM\JoinColumn(name: 'promotion_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Promotion $promotion = null; public function __construct() diff --git a/src/CoreBundle/Entity/SysCalendar.php b/src/CoreBundle/Entity/SysCalendar.php index 92124e5674..428dd72771 100644 --- a/src/CoreBundle/Entity/SysCalendar.php +++ b/src/CoreBundle/Entity/SysCalendar.php @@ -11,48 +11,33 @@ use Doctrine\ORM\Mapping as ORM; /** * SysCalendar. - * - * @ORM\Table(name="sys_calendar") - * @ORM\Entity */ +#[ORM\Table(name: 'sys_calendar')] +#[ORM\Entity] class SysCalendar { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)] protected ?DateTime $startDate = null; - /** - * @ORM\Column(name="end_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)] protected ?DateTime $endDate = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl") - * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrl::class)] + #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected AccessUrl $url; - /** - * @ORM\Column(name="all_day", type="integer", nullable=false) - */ + #[ORM\Column(name: 'all_day', type: 'integer', nullable: false)] protected int $allDay; public function setTitle(string $title): self diff --git a/src/CoreBundle/Entity/SystemTemplate.php b/src/CoreBundle/Entity/SystemTemplate.php index 8ae1dd5985..32ac71cf02 100644 --- a/src/CoreBundle/Entity/SystemTemplate.php +++ b/src/CoreBundle/Entity/SystemTemplate.php @@ -10,37 +10,26 @@ use Doctrine\ORM\Mapping as ORM; /** * SystemTemplate. - * - * @ORM\Table(name="system_template") - * @ORM\Entity */ +#[ORM\Table(name: 'system_template')] +#[ORM\Entity] class SystemTemplate { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)] protected string $title; - /** - * @ORM\Column(name="comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: false)] protected string $comment; - /** - * @ORM\Column(name="image", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'image', type: 'string', length: 250, nullable: false)] protected string $image; - /** - * @ORM\Column(name="content", type="text", nullable=false) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: false)] protected string $content; public function __construct() diff --git a/src/CoreBundle/Entity/Tag.php b/src/CoreBundle/Entity/Tag.php index 8fbba65914..270f3084ce 100644 --- a/src/CoreBundle/Entity/Tag.php +++ b/src/CoreBundle/Entity/Tag.php @@ -11,46 +11,36 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="tag") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\TagRepository") - */ +#[ORM\Table(name: 'tag')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\TagRepository::class)] class Tag { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="tag", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'tag', type: 'string', length: 255, nullable: false)] protected string $tag; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\ExtraField", inversedBy="tags") - * @ORM\JoinColumn(name="field_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\ExtraField::class, inversedBy: 'tags')] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ExtraField $field; /** * @var Collection|UserRelTag[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserRelTag", mappedBy="tag", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\UserRelTag::class, mappedBy: 'tag', cascade: ['persist'])] protected Collection $userRelTags; /** * @var Collection|ExtraFieldRelTag[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ExtraFieldRelTag", mappedBy="tag", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ExtraFieldRelTag::class, mappedBy: 'tag', cascade: ['persist'])] protected Collection $extraFieldRelTags; - /** - * @ORM\Column(name="count", type="integer", nullable=false) - */ + #[ORM\Column(name: 'count', type: 'integer', nullable: false)] protected int $count; public function __construct() diff --git a/src/CoreBundle/Entity/Templates.php b/src/CoreBundle/Entity/Templates.php index 897496cb5c..a5ccc57fb7 100644 --- a/src/CoreBundle/Entity/Templates.php +++ b/src/CoreBundle/Entity/Templates.php @@ -11,51 +11,36 @@ use Doctrine\ORM\Mapping as ORM; /** * Templates. - * - * @ORM\Table(name="templates") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\TemplatesRepository") */ +#[ORM\Table(name: 'templates')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\TemplatesRepository::class)] class Templates { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=100, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 100, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'description', type: 'string', length: 250, nullable: false)] protected string $description; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="templates", cascade={"persist"}) - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'templates', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="templates") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'templates')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="ref_doc", type="integer", nullable=false) - */ + #[ORM\Column(name: 'ref_doc', type: 'integer', nullable: false)] protected int $refDoc; - /** - * @ORM\Column(name="image", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'image', type: 'string', length: 250, nullable: false)] protected string $image; /** diff --git a/src/CoreBundle/Entity/Ticket.php b/src/CoreBundle/Entity/Ticket.php index c05c7c0d2a..a2d5c4b1f6 100644 --- a/src/CoreBundle/Entity/Ticket.php +++ b/src/CoreBundle/Entity/Ticket.php @@ -10,138 +10,87 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="ticket_ticket") - * @ORM\Entity - */ +#[ORM\Table(name: 'ticket_ticket')] +#[ORM\Entity] class Ticket { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="code", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'code', type: 'string', length: 255, nullable: false)] protected string $code; - /** - * @ORM\Column(name="subject", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'subject', type: 'string', length: 255, nullable: false)] protected string $subject; - /** - * @ORM\Column(name="message", type="text", nullable=true) - */ + #[ORM\Column(name: 'message', type: 'text', nullable: true)] protected ?string $message = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketProject") - * @ORM\JoinColumn(name="project_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketProject::class)] + #[ORM\JoinColumn(name: 'project_id', referencedColumnName: 'id')] protected TicketProject $project; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketCategory") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketCategory::class)] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] protected TicketCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketPriority") - * @ORM\JoinColumn(name="priority_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketPriority::class)] + #[ORM\JoinColumn(name: 'priority_id', referencedColumnName: 'id')] protected TicketPriority $priority; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="course_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Session $session; - /** - * @ORM\Column(name="personal_email", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'personal_email', type: 'string', length: 255, nullable: false)] protected string $personalEmail; - /** - * @ORM\Column(name="assigned_last_user", type="integer", nullable=true) - */ - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="assigned_last_user", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'assigned_last_user', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?User $assignedLastUser = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketStatus") - * @ORM\JoinColumn(name="status_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketStatus::class)] + #[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id')] protected TicketStatus $status; - /** - * @ORM\Column(name="total_messages", type="integer", nullable=false) - */ + #[ORM\Column(name: 'total_messages', type: 'integer', nullable: false)] protected int $totalMessages; - /** - * @ORM\Column(name="keyword", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'keyword', type: 'string', length: 255, nullable: true)] protected ?string $keyword = null; - /** - * @ORM\Column(name="source", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'source', type: 'string', length: 255, nullable: true)] protected ?string $source = null; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $startDate = null; - /** - * @ORM\Column(name="end_date", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $endDate = null; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected int $lastEditUserId; - /** - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected DateTime $lastEditDateTime; - /** - * @ORM\Column(name="exercise_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'exercise_id', type: 'integer', nullable: true, unique: false)] protected int $exerciseId; - /** - * @ORM\Column(name="lp_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'lp_id', type: 'integer', nullable: true, unique: false)] protected int $lpId; public function __construct() diff --git a/src/CoreBundle/Entity/TicketAssignedLog.php b/src/CoreBundle/Entity/TicketAssignedLog.php index d39c71f60c..f58c231e97 100644 --- a/src/CoreBundle/Entity/TicketAssignedLog.php +++ b/src/CoreBundle/Entity/TicketAssignedLog.php @@ -9,40 +9,26 @@ namespace Chamilo\CoreBundle\Entity; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="ticket_assigned_log", - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'ticket_assigned_log')] +#[ORM\Entity] class TicketAssignedLog { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Ticket") - * @ORM\JoinColumn(name="ticket_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Ticket::class)] + #[ORM\JoinColumn(name: 'ticket_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Ticket $ticket; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer', nullable: false)] protected int $insertUserId; - /** - * @ORM\Column(name="assigned_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'assigned_date', type: 'datetime', nullable: false)] protected DateTime $assignedDate; } diff --git a/src/CoreBundle/Entity/TicketCategory.php b/src/CoreBundle/Entity/TicketCategory.php index 2310abb859..6610f3e8cd 100644 --- a/src/CoreBundle/Entity/TicketCategory.php +++ b/src/CoreBundle/Entity/TicketCategory.php @@ -11,63 +11,42 @@ use Doctrine\ORM\Mapping as ORM; /** * Category. - * - * @ORM\Table(name="ticket_category") - * @ORM\Entity */ +#[ORM\Table(name: 'ticket_category')] +#[ORM\Entity] class TicketCategory { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="total_tickets", type="integer", nullable=false) - */ + #[ORM\Column(name: 'total_tickets', type: 'integer', nullable: false)] protected int $totalTickets; - /** - * @ORM\Column(name="course_required", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'course_required', type: 'boolean', nullable: false)] protected bool $courseRequired; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketProject") - * @ORM\JoinColumn(name="project_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketProject::class)] + #[ORM\JoinColumn(name: 'project_id', referencedColumnName: 'id')] protected TicketProject $project; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastEditUserId = null; - /** - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEditDateTime = null; public function __construct() diff --git a/src/CoreBundle/Entity/TicketCategoryRelUser.php b/src/CoreBundle/Entity/TicketCategoryRelUser.php index 068689e849..03ae444435 100644 --- a/src/CoreBundle/Entity/TicketCategoryRelUser.php +++ b/src/CoreBundle/Entity/TicketCategoryRelUser.php @@ -10,28 +10,21 @@ use Doctrine\ORM\Mapping as ORM; /** * CategoryRelUser. - * - * @ORM\Table(name="ticket_category_rel_user") - * @ORM\Entity */ +#[ORM\Table(name: 'ticket_category_rel_user')] +#[ORM\Entity] class TicketCategoryRelUser { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketCategory") - * @ORM\JoinColumn(name="category_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketCategory::class)] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] protected TicketCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected TicketCategory $user; } diff --git a/src/CoreBundle/Entity/TicketMessage.php b/src/CoreBundle/Entity/TicketMessage.php index 971d11b07c..2484f281b8 100644 --- a/src/CoreBundle/Entity/TicketMessage.php +++ b/src/CoreBundle/Entity/TicketMessage.php @@ -10,65 +10,43 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table(name="ticket_message") - * @ORM\Entity - */ +#[ORM\Table(name: 'ticket_message')] +#[ORM\Entity] class TicketMessage { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="subject", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'subject', type: 'string', length: 255, nullable: false)] protected string $subject; - /** - * @ORM\Column(name="message", type="text", nullable=true) - */ + #[ORM\Column(name: 'message', type: 'text', nullable: true)] protected ?string $message = null; - /** - * @ORM\Column(name="status", type="string", nullable=false) - */ + #[ORM\Column(name: 'status', type: 'string', nullable: false)] protected string $status; - /** - * @ORM\Column(name="ip_address", type="string", nullable=false) - */ + #[ORM\Column(name: 'ip_address', type: 'string', nullable: false)] protected string $ipAddress; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Ticket") - * @ORM\JoinColumn(name="ticket_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Ticket::class)] + #[ORM\JoinColumn(name: 'ticket_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Ticket $ticket; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastEditUserId = null; - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEditDateTime = null; /** diff --git a/src/CoreBundle/Entity/TicketMessageAttachment.php b/src/CoreBundle/Entity/TicketMessageAttachment.php index d0ea5784af..c8c72c87a7 100644 --- a/src/CoreBundle/Entity/TicketMessageAttachment.php +++ b/src/CoreBundle/Entity/TicketMessageAttachment.php @@ -9,64 +9,42 @@ namespace Chamilo\CoreBundle\Entity; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="ticket_message_attachments") - * @ORM\Entity - */ -class TicketMessageAttachment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'ticket_message_attachments')] +#[ORM\Entity] +class TicketMessageAttachment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Ticket") - * @ORM\JoinColumn(name="ticket_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Ticket::class)] + #[ORM\JoinColumn(name: 'ticket_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Ticket $ticket; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TicketMessage") - * @ORM\JoinColumn(name="message_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TicketMessage::class)] + #[ORM\JoinColumn(name: 'message_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected TicketMessage $message; - /** - * @ORM\Column(name="path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)] protected string $path; - /** - * @ORM\Column(name="filename", type="text", nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'text', nullable: false)] protected string $filename; - /** - * @ORM\Column(name="size", type="integer") - */ + #[ORM\Column(name: 'size', type: 'integer')] protected int $size; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastEditUserId = null; - /** - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEditDateTime = null; public function __toString(): string diff --git a/src/CoreBundle/Entity/TicketPriority.php b/src/CoreBundle/Entity/TicketPriority.php index 955bfb36bf..e35b4c323d 100644 --- a/src/CoreBundle/Entity/TicketPriority.php +++ b/src/CoreBundle/Entity/TicketPriority.php @@ -11,62 +11,41 @@ use Doctrine\ORM\Mapping as ORM; /** * Priority. - * - * @ORM\Table(name="ticket_priority") - * @ORM\Entity */ +#[ORM\Table(name: 'ticket_priority')] +#[ORM\Entity] class TicketPriority { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="code", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'code', type: 'string', length: 255, nullable: false)] protected string $code; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="color", type="string", nullable=false) - */ + #[ORM\Column(name: 'color', type: 'string', nullable: false)] protected string $color; - /** - * @ORM\Column(name="urgency", type="string", nullable=false) - */ + #[ORM\Column(name: 'urgency', type: 'string', nullable: false)] protected string $urgency; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastEditUserId = null; - /** - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEditDateTime = null; public function __construct() diff --git a/src/CoreBundle/Entity/TicketProject.php b/src/CoreBundle/Entity/TicketProject.php index 4d24d5b437..090a49355e 100644 --- a/src/CoreBundle/Entity/TicketProject.php +++ b/src/CoreBundle/Entity/TicketProject.php @@ -11,57 +11,38 @@ use Doctrine\ORM\Mapping as ORM; /** * Project. - * - * @ORM\Table(name="ticket_project") - * @ORM\Entity */ +#[ORM\Table(name: 'ticket_project')] +#[ORM\Entity] class TicketProject { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="email", type="string", nullable=true) - */ + #[ORM\Column(name: 'email', type: 'string', nullable: true)] protected ?string $email = null; - /** - * @ORM\Column(name="other_area", type="integer", nullable=true) - */ + #[ORM\Column(name: 'other_area', type: 'integer', nullable: true)] protected ?string $otherArea = null; - /** - * @ORM\Column(name="sys_insert_user_id", type="integer") - */ + #[ORM\Column(name: 'sys_insert_user_id', type: 'integer')] protected int $insertUserId; - /** - * @ORM\Column(name="sys_insert_datetime", type="datetime") - */ + #[ORM\Column(name: 'sys_insert_datetime', type: 'datetime')] protected DateTime $insertDateTime; - /** - * @ORM\Column(name="sys_lastedit_user_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_user_id', type: 'integer', nullable: true, unique: false)] protected ?int $lastEditUserId = null; - /** - * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'sys_lastedit_datetime', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $lastEditDateTime = null; public function __construct() diff --git a/src/CoreBundle/Entity/TicketStatus.php b/src/CoreBundle/Entity/TicketStatus.php index b972a1f560..86a22da4b5 100644 --- a/src/CoreBundle/Entity/TicketStatus.php +++ b/src/CoreBundle/Entity/TicketStatus.php @@ -10,32 +10,23 @@ use Doctrine\ORM\Mapping as ORM; /** * Status. - * - * @ORM\Table(name="ticket_status") - * @ORM\Entity */ +#[ORM\Table(name: 'ticket_status')] +#[ORM\Entity] class TicketStatus { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="code", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'code', type: 'string', length: 255, nullable: false)] protected string $code; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** diff --git a/src/CoreBundle/Entity/Tool.php b/src/CoreBundle/Entity/Tool.php index 10072c0868..4a20a5e37c 100644 --- a/src/CoreBundle/Entity/Tool.php +++ b/src/CoreBundle/Entity/Tool.php @@ -15,31 +15,25 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Platform tools. - * - * @ORM\Table(name="tool") - * @ORM\Entity */ -class Tool +#[ORM\Table(name: 'tool')] +#[ORM\Entity] +class Tool implements \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @Groups({"tool:read"}) - * @ORM\Column(name="name", type="string", nullable=false, unique=true) - */ #[Assert\NotBlank] + #[Groups(['tool:read'])] + #[ORM\Column(name: 'name', type: 'string', nullable: false, unique: true)] protected string $name; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceType", mappedBy="tool", cascade={"persist", "remove"}) - * * @var ResourceType[]|Collection */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\ResourceType::class, mappedBy: 'tool', cascade: ['persist', 'remove'])] protected Collection $resourceTypes; public function __construct() diff --git a/src/CoreBundle/Entity/ToolResourceRight.php b/src/CoreBundle/Entity/ToolResourceRight.php index 39ea75318c..ea322a787c 100644 --- a/src/CoreBundle/Entity/ToolResourceRight.php +++ b/src/CoreBundle/Entity/ToolResourceRight.php @@ -11,39 +11,30 @@ use Doctrine\ORM\Mapping as ORM; /** * ToolResourceRight. - * - * @ORM\Table(name="tool_resource_right") - * @ORM\Entity */ -class ToolResourceRight +#[ORM\Table(name: 'tool_resource_right')] +#[ORM\Entity] +class ToolResourceRight implements \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="role", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'role', type: 'string', length: 255, nullable: false)] protected string $role; - /** - * @ORM\Column(name="mask", type="integer", nullable=false) - */ + #[ORM\Column(name: 'mask', type: 'integer', nullable: false)] protected int $mask; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tool", cascade={"persist"}) - * @ORM\JoinColumn(name="tool_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Tool::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id')] protected ?Tool $tool = null; /** * @return string */ - public function __toString() + public function __toString(): string { return (string) $this->getMask(); } diff --git a/src/CoreBundle/Entity/TrackCourseRanking.php b/src/CoreBundle/Entity/TrackCourseRanking.php index ff26e48283..0588670cc7 100644 --- a/src/CoreBundle/Entity/TrackCourseRanking.php +++ b/src/CoreBundle/Entity/TrackCourseRanking.php @@ -12,17 +12,6 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\Table( - * name="track_course_ranking", - * indexes={ - * @ORM\Index(name="idx_tcc_cid", columns={"c_id"}), - * @ORM\Index(name="idx_tcc_sid", columns={"session_id"}), - * @ORM\Index(name="idx_tcc_urlid", columns={"url_id"}), - * @ORM\Index(name="idx_tcc_creation_date", columns={"creation_date"}) - * }) - * @ORM\Entity - */ #[ApiResource( attributes: [ 'security' => "is_granted('ROLE_USER')", @@ -34,57 +23,47 @@ use Symfony\Component\Serializer\Annotation\Groups; 'groups' => ['trackCourseRanking:read'], ], )] +#[ORM\Table(name: 'track_course_ranking')] +#[ORM\Index(name: 'idx_tcc_cid', columns: ['c_id'])] +#[ORM\Index(name: 'idx_tcc_sid', columns: ['session_id'])] +#[ORM\Index(name: 'idx_tcc_urlid', columns: ['url_id'])] +#[ORM\Index(name: 'idx_tcc_creation_date', columns: ['creation_date'])] +#[ORM\Entity] class TrackCourseRanking { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ #[Groups(['course:read', 'trackCourseRanking:read'])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="trackCourseRanking") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="cascade") - */ #[ApiSubresource] #[Groups(['course:read', 'trackCourseRanking:read', 'trackCourseRanking:write'])] + #[ORM\OneToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'trackCourseRanking')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'cascade')] protected Course $course; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ #[Groups(['trackCourseRanking:read', 'trackCourseRanking:write'])] + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="url_id", type="integer", nullable=false) - */ #[Groups(['trackCourseRanking:read', 'trackCourseRanking:write'])] + #[ORM\Column(name: 'url_id', type: 'integer', nullable: false)] protected int $urlId; - /** - * @ORM\Column(name="accesses", type="integer", nullable=false) - */ #[Groups(['course:read', 'trackCourseRanking:read'])] + #[ORM\Column(name: 'accesses', type: 'integer', nullable: false)] protected int $accesses; - /** - * @ORM\Column(name="total_score", type="integer", nullable=false) - */ #[Groups(['course:read', 'trackCourseRanking:read', 'trackCourseRanking:write'])] + #[ORM\Column(name: 'total_score', type: 'integer', nullable: false)] protected int $totalScore; - /** - * @ORM\Column(name="users", type="integer", nullable=false) - */ #[Groups(['course:read'])] + #[ORM\Column(name: 'users', type: 'integer', nullable: false)] protected int $users; - /** - * @ORM\Column(name="creation_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'creation_date', type: 'datetime', nullable: false)] protected DateTime $creationDate; #[Groups(['course:read', 'trackCourseRanking:read'])] diff --git a/src/CoreBundle/Entity/TrackEAccess.php b/src/CoreBundle/Entity/TrackEAccess.php index 902a17f639..826aa526d8 100644 --- a/src/CoreBundle/Entity/TrackEAccess.php +++ b/src/CoreBundle/Entity/TrackEAccess.php @@ -11,52 +11,36 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEAccess. - * - * @ORM\Table(name="track_e_access", indexes={ - * @ORM\Index(name="access_user_id", columns={"access_user_id"}), - * @ORM\Index(name="access_c_id", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}), - * @ORM\Index(name="user_course_session_date", columns={"access_user_id", "c_id", "session_id", "access_date"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_access')] +#[ORM\Index(name: 'access_user_id', columns: ['access_user_id'])] +#[ORM\Index(name: 'access_c_id', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Index(name: 'user_course_session_date', columns: ['access_user_id', 'c_id', 'session_id', 'access_date'])] +#[ORM\Entity] class TrackEAccess { - /** - * @ORM\Column(name="access_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'access_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $accessId; - /** - * @ORM\Column(name="access_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'access_user_id', type: 'integer', nullable: true)] protected ?int $accessUserId = null; - /** - * @ORM\Column(name="access_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'access_date', type: 'datetime', nullable: false)] protected DateTime $accessDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="access_tool", type="string", length=30, nullable=true) - */ + #[ORM\Column(name: 'access_tool', type: 'string', length: 30, nullable: true)] protected ?string $accessTool = null; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; /** diff --git a/src/CoreBundle/Entity/TrackEAccessComplete.php b/src/CoreBundle/Entity/TrackEAccessComplete.php index 64337ba2e0..c2a20487df 100644 --- a/src/CoreBundle/Entity/TrackEAccessComplete.php +++ b/src/CoreBundle/Entity/TrackEAccessComplete.php @@ -11,99 +11,64 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEAccessComplete. - * - * @ORM\Table(name="track_e_access_complete") - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_access_complete')] +#[ORM\Entity] class TrackEAccessComplete { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="trackEAccessCompleteList") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'trackEAccessCompleteList')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)] protected User $user; - /** - * @ORM\Column(name="date_reg", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'date_reg', type: 'datetime', nullable: false)] protected int $dateReg; - /** - * @ORM\Column(name="tool", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'tool', type: 'string', length: 255, nullable: false)] protected string $tool; - /** - * @ORM\Column(name="tool_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'tool_id', type: 'integer', nullable: false)] protected int $toolId; - /** - * @ORM\Column(name="tool_id_detail", type="integer", nullable=false) - */ + #[ORM\Column(name: 'tool_id_detail', type: 'integer', nullable: false)] protected int $toolIdDetail; - /** - * @ORM\Column(name="action", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'action', type: 'string', length: 255, nullable: false)] protected string $action; - /** - * @ORM\Column(name="action_details", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'action_details', type: 'string', length: 255, nullable: false)] protected string $actionDetails; - /** - * @ORM\Column(name="current_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'current_id', type: 'integer', nullable: false)] protected int $currentId; - /** - * @ORM\Column(name="ip_user", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'ip_user', type: 'string', length: 255, nullable: false)] protected string $ipUser; - /** - * @ORM\Column(name="user_agent", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'user_agent', type: 'string', length: 255, nullable: false)] protected string $userAgent; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="ch_sid", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'ch_sid', type: 'string', length: 255, nullable: false)] protected string $chSid; - /** - * @ORM\Column(name="login_as", type="integer", nullable=false) - */ + #[ORM\Column(name: 'login_as', type: 'integer', nullable: false)] protected int $loginAs; - /** - * @ORM\Column(name="info", type="text", nullable=false) - */ + #[ORM\Column(name: 'info', type: 'text', nullable: false)] protected string $info; - /** - * @ORM\Column(name="url", type="text", nullable=false) - */ + #[ORM\Column(name: 'url', type: 'text', nullable: false)] protected string $url; } diff --git a/src/CoreBundle/Entity/TrackEAttempt.php b/src/CoreBundle/Entity/TrackEAttempt.php index 42cd29a5a2..69805ffe49 100644 --- a/src/CoreBundle/Entity/TrackEAttempt.php +++ b/src/CoreBundle/Entity/TrackEAttempt.php @@ -19,17 +19,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Questions per quiz user attempts. - * - * @ORM\Table( - * name="track_e_attempt", - * indexes={ - * @ORM\Index(name="exe_id", columns={"exe_id"}), - * @ORM\Index(name="user_id", columns={"user_id"}), - * @ORM\Index(name="question_id", columns={"question_id"}), - * @ORM\Index(name="idx_track_e_attempt_tms", columns={"tms"}), - * } - * ) - * @ORM\Entity */ #[ApiResource( collectionOperations: [ @@ -58,89 +47,71 @@ use Symfony\Component\Validator\Constraints as Assert; 'marks' => 'exact', ] )] +#[ORM\Table(name: 'track_e_attempt')] +#[ORM\Index(name: 'exe_id', columns: ['exe_id'])] +#[ORM\Index(name: 'user_id', columns: ['user_id'])] +#[ORM\Index(name: 'question_id', columns: ['question_id'])] +#[ORM\Index(name: 'idx_track_e_attempt_tms', columns: ['tms'])] +#[ORM\Entity] class TrackEAttempt { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TrackEExercise", inversedBy="attempts") - * @ORM\JoinColumn(name="exe_id", referencedColumnName="exe_id", nullable=false, onDelete="CASCADE") - */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\TrackEExercise::class, inversedBy: 'attempts')] + #[ORM\JoinColumn(name: 'exe_id', referencedColumnName: 'exe_id', nullable: false, onDelete: 'CASCADE')] protected TrackEExercise $trackExercise; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="trackEAttempts") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['track_e_attempt:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'trackEAttempts')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="question_id", type="integer", nullable=false) - */ #[Assert\NotBlank] #[Groups(['track_e_attempt:read'])] + #[ORM\Column(name: 'question_id', type: 'integer', nullable: false)] protected ?int $questionId = null; - /** - * @ORM\Column(name="answer", type="text", nullable=false) - */ #[Groups(['track_e_attempt:read'])] + #[ORM\Column(name: 'answer', type: 'text', nullable: false)] protected string $answer; - /** - * @ORM\Column(name="teacher_comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'teacher_comment', type: 'text', nullable: false)] protected string $teacherComment; - /** - * @ORM\Column(name="marks", type="float", precision=6, scale=2, nullable=false) - */ #[Groups(['track_e_attempt:read'])] + #[ORM\Column(name: 'marks', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $marks; - /** - * @ORM\Column(name="position", type="integer", nullable=true) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: true)] protected ?int $position = null; - /** - * @ORM\Column(name="tms", type="datetime", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'tms', type: 'datetime', nullable: false)] protected DateTime $tms; - /** - * @ORM\Column(name="filename", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: true)] protected ?string $filename = null; - /** - * @ORM\Column(name="seconds_spent", type="integer") - */ + #[ORM\Column(name: 'seconds_spent', type: 'integer')] protected int $secondsSpent; /** * @var Collection|AttemptFile[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AttemptFile", mappedBy="attempt", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\AttemptFile::class, mappedBy: 'attempt', cascade: ['persist'], orphanRemoval: true)] protected Collection $attemptFiles; /** * @var Collection|AttemptFeedback[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AttemptFeedback", mappedBy="attempt", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\AttemptFeedback::class, mappedBy: 'attempt', cascade: ['persist'], orphanRemoval: true)] protected Collection $attemptFeedbacks; public function __construct() @@ -324,7 +295,7 @@ class TrackEAttempt /** * @return AttemptFile[]|Collection */ - public function getAttemptFiles() + public function getAttemptFiles(): array|\Doctrine\Common\Collections\Collection { return $this->attemptFiles; } @@ -332,7 +303,7 @@ class TrackEAttempt /** * @param AttemptFile[]|Collection $attemptFiles */ - public function setAttemptFiles($attemptFiles): self + public function setAttemptFiles(array|\Doctrine\Common\Collections\Collection $attemptFiles): self { $this->attemptFiles = $attemptFiles; @@ -342,7 +313,7 @@ class TrackEAttempt /** * @return AttemptFeedback[]|Collection */ - public function getAttemptFeedbacks() + public function getAttemptFeedbacks(): array|\Doctrine\Common\Collections\Collection { return $this->attemptFeedbacks; } @@ -350,7 +321,7 @@ class TrackEAttempt /** * @param AttemptFeedback[]|Collection $attemptFeedbacks */ - public function setAttemptFeedbacks($attemptFeedbacks): self + public function setAttemptFeedbacks(array|\Doctrine\Common\Collections\Collection $attemptFeedbacks): self { $this->attemptFeedbacks = $attemptFeedbacks; diff --git a/src/CoreBundle/Entity/TrackEAttemptCoeff.php b/src/CoreBundle/Entity/TrackEAttemptCoeff.php index cde5d67db0..a4162ad1e3 100644 --- a/src/CoreBundle/Entity/TrackEAttemptCoeff.php +++ b/src/CoreBundle/Entity/TrackEAttemptCoeff.php @@ -10,27 +10,20 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEAttemptCoeff. - * - * @ORM\Table(name="track_e_attempt_coeff") - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_attempt_coeff')] +#[ORM\Entity] class TrackEAttemptCoeff { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="attempt_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'attempt_id', type: 'integer', nullable: false)] protected int $attemptId; - /** - * @ORM\Column(name="marks_coeff", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'marks_coeff', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $marksCoeff = null; /** diff --git a/src/CoreBundle/Entity/TrackEAttemptRecording.php b/src/CoreBundle/Entity/TrackEAttemptRecording.php index 2021edbc74..15025b7f1f 100644 --- a/src/CoreBundle/Entity/TrackEAttemptRecording.php +++ b/src/CoreBundle/Entity/TrackEAttemptRecording.php @@ -12,64 +12,42 @@ use Gedmo\Mapping\Annotation as Gedmo; /** * TrackEAttemptRecording. - * - * @ORM\Table(name="track_e_attempt_recording", - * indexes={ - * @ORM\Index(name="exe_id", columns={"exe_id"}), - * @ORM\Index(name="question_id", columns={"question_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_attempt_recording')] +#[ORM\Index(name: 'exe_id', columns: ['exe_id'])] +#[ORM\Index(name: 'question_id', columns: ['question_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackEAttemptRecording { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="exe_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'exe_id', type: 'integer', nullable: false)] protected int $exeId; - /** - * @ORM\Column(name="question_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'question_id', type: 'integer', nullable: false)] protected int $questionId; - /** - * @ORM\Column(name="marks", type="integer", nullable=false) - */ + #[ORM\Column(name: 'marks', type: 'integer', nullable: false)] protected int $marks; - /** - * @Gedmo\Timestampable(on="create") - * - * @ORM\Column(name="insert_date", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'insert_date', type: 'datetime', nullable: false)] protected DateTime $insertDate; - /** - * @ORM\Column(name="author", type="integer", nullable=false) - */ + #[ORM\Column(name: 'author', type: 'integer', nullable: false)] protected int $author; - /** - * @ORM\Column(name="teacher_comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'teacher_comment', type: 'text', nullable: false)] protected string $teacherComment; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="answer", type="text", nullable=true) - */ + #[ORM\Column(name: 'answer', type: 'text', nullable: true)] protected ?string $answer; public function __construct() diff --git a/src/CoreBundle/Entity/TrackECourseAccess.php b/src/CoreBundle/Entity/TrackECourseAccess.php index e88b693e76..33150d9996 100644 --- a/src/CoreBundle/Entity/TrackECourseAccess.php +++ b/src/CoreBundle/Entity/TrackECourseAccess.php @@ -12,64 +12,43 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackECourseAccess. - * - * @ORM\Table( - * name="track_e_course_access", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user_id", columns={"user_id"}), - * @ORM\Index(name="login_course_date", columns={"login_course_date"}), - * @ORM\Index(name="session_id", columns={"session_id"}), - * @ORM\Index(name="user_course_session_date", columns={"user_id", "c_id", "session_id", "login_course_date"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\TrackECourseAccessRepository") */ +#[ORM\Table(name: 'track_e_course_access')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user_id', columns: ['user_id'])] +#[ORM\Index(name: 'login_course_date', columns: ['login_course_date'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Index(name: 'user_course_session_date', columns: ['user_id', 'c_id', 'session_id', 'login_course_date'])] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\TrackECourseAccessRepository::class)] class TrackECourseAccess { use UserTrait; - /** - * @ORM\Column(name="course_access_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'course_access_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $courseAccessId; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="trackECourseAccess") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'trackECourseAccess')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="login_course_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'login_course_date', type: 'datetime', nullable: false)] protected DateTime $loginCourseDate; - /** - * @ORM\Column(name="logout_course_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'logout_course_date', type: 'datetime', nullable: true)] protected ?DateTime $logoutCourseDate = null; - /** - * @ORM\Column(name="counter", type="integer", nullable=false) - */ + #[ORM\Column(name: 'counter', type: 'integer', nullable: false)] protected int $counter; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; /** @@ -130,10 +109,8 @@ class TrackECourseAccess /** * Get logoutCourseDate. - * - * @return null|DateTime */ - public function getLogoutCourseDate() + public function getLogoutCourseDate(): ?\DateTime { return $this->logoutCourseDate; } diff --git a/src/CoreBundle/Entity/TrackEDefault.php b/src/CoreBundle/Entity/TrackEDefault.php index 246e5c6416..4a8a55fe4b 100644 --- a/src/CoreBundle/Entity/TrackEDefault.php +++ b/src/CoreBundle/Entity/TrackEDefault.php @@ -11,59 +11,38 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEDefault. - * - * @ORM\Table( - * name="track_e_default", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session", columns={"session_id"}), - * @ORM\Index(name="idx_default_user_id", columns={"default_user_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_default')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'session', columns: ['session_id'])] +#[ORM\Index(name: 'idx_default_user_id', columns: ['default_user_id'])] +#[ORM\Entity] class TrackEDefault { - /** - * @ORM\Column(name="default_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'default_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $defaultId; - /** - * @ORM\Column(name="default_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'default_user_id', type: 'integer', nullable: false)] protected int $defaultUserId; - /** - * @ORM\Column(name="c_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: true)] protected ?int $cId = null; - /** - * @ORM\Column(name="default_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'default_date', type: 'datetime', nullable: false)] protected DateTime $defaultDate; - /** - * @ORM\Column(name="default_event_type", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'default_event_type', type: 'string', length: 255, nullable: false)] protected string $defaultEventType; - /** - * @ORM\Column(name="default_value_type", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'default_value_type', type: 'string', length: 255, nullable: false)] protected string $defaultValueType; - /** - * @ORM\Column(name="default_value", type="text", nullable=false) - */ + #[ORM\Column(name: 'default_value', type: 'text', nullable: false)] protected string $defaultValue; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; /** diff --git a/src/CoreBundle/Entity/TrackEDownloads.php b/src/CoreBundle/Entity/TrackEDownloads.php index ae40585fcc..2e1ae9e92c 100644 --- a/src/CoreBundle/Entity/TrackEDownloads.php +++ b/src/CoreBundle/Entity/TrackEDownloads.php @@ -11,46 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEDownloads. - * - * @ORM\Table(name="track_e_downloads", indexes={ - * @ORM\Index(name="idx_ted_user_id", columns={"down_user_id"}), - * @ORM\Index(name="idx_ted_c_id", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_downloads')] +#[ORM\Index(name: 'idx_ted_user_id', columns: ['down_user_id'])] +#[ORM\Index(name: 'idx_ted_c_id', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackEDownloads { - /** - * @ORM\Column(name="down_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'down_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $downId; - /** - * @ORM\Column(name="down_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'down_user_id', type: 'integer', nullable: true)] protected ?int $downUserId = null; - /** - * @ORM\Column(name="down_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'down_date', type: 'datetime', nullable: false)] protected DateTime $downDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="down_doc_path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'down_doc_path', type: 'string', length: 255, nullable: false)] protected string $downDocPath; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; /** diff --git a/src/CoreBundle/Entity/TrackEExercise.php b/src/CoreBundle/Entity/TrackEExercise.php index 99e02a1cec..bb680384a7 100644 --- a/src/CoreBundle/Entity/TrackEExercise.php +++ b/src/CoreBundle/Entity/TrackEExercise.php @@ -22,13 +22,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Quiz user attempts. - * - * @ORM\Table(name="track_e_exercises", indexes={ - * @ORM\Index(name="idx_tee_user_id", columns={"exe_user_id"}), - * @ORM\Index(name="idx_tee_c_id", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * }) - * @ORM\Entity */ #[ApiResource( collectionOperations: [ @@ -74,152 +67,116 @@ use Symfony\Component\Validator\Constraints as Assert; 'userIp', ] )] +#[ORM\Table(name: 'track_e_exercises')] +#[ORM\Index(name: 'idx_tee_user_id', columns: ['exe_user_id'])] +#[ORM\Index(name: 'idx_tee_c_id', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackEExercise { use UserExtraFieldFilterTrait; - /** - * @ORM\Column(name="exe_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'exe_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $exeId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="exe_user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'exe_user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ #[Groups(['track_e_exercise:read'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\Column(name="exe_date", type="datetime", nullable=false) - */ #[Assert\NotBlank] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'exe_date', type: 'datetime', nullable: false)] protected DateTime $exeDate; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuiz", inversedBy="attempts") - * @ORM\JoinColumn(name="exe_exo_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") - */ #[Groups(['track_e_exercise:read'])] - protected ?CQuiz $quiz; + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuiz::class, inversedBy: 'attempts')] + #[ORM\JoinColumn(name: 'exe_exo_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')] + protected ?CQuiz $quiz = null; - /** - * @ORM\Column(name="score", type="float", precision=6, scale=2, nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'score', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $score; - /** - * @ORM\Column(name="max_score", type="float", precision=6, scale=2, nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'max_score', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $maxScore; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ #[Assert\NotBlank] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; - /** - * @ORM\Column(name="status", type="string", length=20, nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'status', type: 'string', length: 20, nullable: false)] protected string $status; - /** - * @ORM\Column(name="data_tracking", type="text", nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'data_tracking', type: 'text', nullable: false)] protected string $dataTracking; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=false) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: false)] protected DateTime $startDate; - /** - * @ORM\Column(name="steps_counter", type="smallint", nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'steps_counter', type: 'smallint', nullable: false)] protected int $stepsCounter; - /** - * @ORM\Column(name="orig_lp_id", type="integer", nullable=false) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'orig_lp_id', type: 'integer', nullable: false)] protected int $origLpId; - /** - * @ORM\Column(name="orig_lp_item_id", type="integer", nullable=false) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'orig_lp_item_id', type: 'integer', nullable: false)] protected int $origLpItemId; - /** - * @ORM\Column(name="exe_duration", type="integer", nullable=false) - */ #[Assert\NotNull] #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'exe_duration', type: 'integer', nullable: false)] protected int $exeDuration; - /** - * @ORM\Column(name="expired_time_control", type="datetime", nullable=true) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'expired_time_control', type: 'datetime', nullable: true)] protected ?DateTime $expiredTimeControl = null; - /** - * @ORM\Column(name="orig_lp_item_view_id", type="integer", nullable=false) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'orig_lp_item_view_id', type: 'integer', nullable: false)] protected int $origLpItemViewId; - /** - * @ORM\Column(name="questions_to_check", type="text", nullable=false) - */ #[Groups(['track_e_exercise:read'])] #[Assert\NotNull] + #[ORM\Column(name: 'questions_to_check', type: 'text', nullable: false)] protected string $questionsToCheck; - /** - * @ORM\Column(name="blocked_categories", type="text", nullable=true) - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'blocked_categories', type: 'text', nullable: true)] protected ?string $blockedCategories; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", mappedBy="trackExercise", cascade={"persist"}) */ #[Groups(['track_e_exercise:read'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\TrackEAttempt::class, mappedBy: 'trackExercise', cascade: ['persist'])] protected Collection $attempts; public function __construct() @@ -508,7 +465,7 @@ class TrackEExercise /** * @return TrackEAttempt[]|Collection */ - public function getAttempts() + public function getAttempts(): array|\Doctrine\Common\Collections\Collection { return $this->attempts; } @@ -516,7 +473,7 @@ class TrackEExercise /** * @param TrackEAttempt[]|Collection $attempts */ - public function setAttempts($attempts): self + public function setAttempts(array|\Doctrine\Common\Collections\Collection $attempts): self { $this->attempts = $attempts; diff --git a/src/CoreBundle/Entity/TrackEExerciseConfirmation.php b/src/CoreBundle/Entity/TrackEExerciseConfirmation.php index 1772cc2b71..09920c0474 100644 --- a/src/CoreBundle/Entity/TrackEExerciseConfirmation.php +++ b/src/CoreBundle/Entity/TrackEExerciseConfirmation.php @@ -10,61 +10,41 @@ use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="track_e_exercise_confirmation") - * @ORM\Entity() - */ +#[ORM\Table(name: 'track_e_exercise_confirmation')] +#[ORM\Entity] class TrackEExerciseConfirmation { use TimestampableEntity; use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="trackEExerciseConfirmations") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'trackEExerciseConfirmations')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="course_id", type="integer") - */ + #[ORM\Column(name: 'course_id', type: 'integer')] private int $courseId; - /** - * @ORM\Column(name="attempt_id", type="integer") - */ + #[ORM\Column(name: 'attempt_id', type: 'integer')] private int $attemptId; - /** - * @ORM\Column(name="quiz_id", type="integer") - */ + #[ORM\Column(name: 'quiz_id', type: 'integer')] private int $quizId; - /** - * @ORM\Column(name="session_id", type="integer") - */ + #[ORM\Column(name: 'session_id', type: 'integer')] private int $sessionId; - /** - * @ORM\Column(name="confirmed", type="boolean", options={"default":false}) - */ + #[ORM\Column(name: 'confirmed', type: 'boolean', options: ['default' => false])] private bool $confirmed; - /** - * @ORM\Column(name="questions_count", type="integer") - */ + #[ORM\Column(name: 'questions_count', type: 'integer')] private int $questionsCount; - /** - * @ORM\Column(name="saved_answers_count", type="integer") - */ + #[ORM\Column(name: 'saved_answers_count', type: 'integer')] private int $savedAnswersCount; public function __construct() diff --git a/src/CoreBundle/Entity/TrackEHotpotatoes.php b/src/CoreBundle/Entity/TrackEHotpotatoes.php index 61bc06d380..bffe834612 100644 --- a/src/CoreBundle/Entity/TrackEHotpotatoes.php +++ b/src/CoreBundle/Entity/TrackEHotpotatoes.php @@ -11,50 +11,34 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEHotpotatoes. - * - * @ORM\Table(name="track_e_hotpotatoes", indexes={ - * @ORM\Index(name="idx_tehp_user_id", columns={"exe_user_id"}), - * @ORM\Index(name="idx_tehp_c_id", columns={"c_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_hotpotatoes')] +#[ORM\Index(name: 'idx_tehp_user_id', columns: ['exe_user_id'])] +#[ORM\Index(name: 'idx_tehp_c_id', columns: ['c_id'])] +#[ORM\Entity] class TrackEHotpotatoes { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="exe_name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'exe_name', type: 'string', length: 255, nullable: false)] protected string $exeName; - /** - * @ORM\Column(name="exe_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'exe_user_id', type: 'integer', nullable: true)] protected ?int $exeUserId = null; - /** - * @ORM\Column(name="exe_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'exe_date', type: 'datetime', nullable: false)] protected DateTime $exeDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="score", type="smallint", nullable=false) - */ + #[ORM\Column(name: 'score', type: 'smallint', nullable: false)] protected int $score; - /** - * @ORM\Column(name="max_score", type="smallint", nullable=false) - */ + #[ORM\Column(name: 'max_score', type: 'smallint', nullable: false)] protected int $maxScore; /** diff --git a/src/CoreBundle/Entity/TrackEHotspot.php b/src/CoreBundle/Entity/TrackEHotspot.php index 6795b03795..aa747a76dd 100644 --- a/src/CoreBundle/Entity/TrackEHotspot.php +++ b/src/CoreBundle/Entity/TrackEHotspot.php @@ -11,59 +11,41 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEHotspot. - * - * @ORM\Table(name="track_e_hotspot", indexes={ - * @ORM\Index(name="hotspot_user_id", columns={"hotspot_user_id"}), - * @ORM\Index(name="hotspot_exe_id", columns={"hotspot_exe_id"}), - * @ORM\Index(name="hotspot_question_id", columns={"hotspot_question_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_hotspot')] +#[ORM\Index(name: 'hotspot_user_id', columns: ['hotspot_user_id'])] +#[ORM\Index(name: 'hotspot_exe_id', columns: ['hotspot_exe_id'])] +#[ORM\Index(name: 'hotspot_question_id', columns: ['hotspot_question_id'])] +#[ORM\Entity] class TrackEHotspot { use CourseTrait; - /** - * @ORM\Column(name="hotspot_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'hotspot_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $hotspotId; - /** - * @ORM\Column(name="hotspot_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hotspot_user_id', type: 'integer', nullable: false)] protected int $hotspotUserId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="trackEHotspots") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class, inversedBy: 'trackEHotspots')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected ?Course $course = null; - /** - * @ORM\Column(name="hotspot_exe_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hotspot_exe_id', type: 'integer', nullable: false)] protected int $hotspotExeId; - /** - * @ORM\Column(name="hotspot_question_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hotspot_question_id', type: 'integer', nullable: false)] protected int $hotspotQuestionId; - /** - * @ORM\Column(name="hotspot_answer_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'hotspot_answer_id', type: 'integer', nullable: false)] protected int $hotspotAnswerId; - /** - * @ORM\Column(name="hotspot_correct", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'hotspot_correct', type: 'boolean', nullable: false)] protected bool $hotspotCorrect; - /** - * @ORM\Column(name="hotspot_coordinate", type="text", nullable=false) - */ + #[ORM\Column(name: 'hotspot_coordinate', type: 'text', nullable: false)] protected string $hotspotCoordinate; /** diff --git a/src/CoreBundle/Entity/TrackELastaccess.php b/src/CoreBundle/Entity/TrackELastaccess.php index 93fb46e091..a4ae86f3e3 100644 --- a/src/CoreBundle/Entity/TrackELastaccess.php +++ b/src/CoreBundle/Entity/TrackELastaccess.php @@ -11,46 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackELastaccess. - * - * @ORM\Table(name="track_e_lastaccess", indexes={ - * @ORM\Index(name="access_user_id", columns={"access_user_id"}), - * @ORM\Index(name="access_c_id", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_lastaccess')] +#[ORM\Index(name: 'access_user_id', columns: ['access_user_id'])] +#[ORM\Index(name: 'access_c_id', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackELastaccess { - /** - * @ORM\Column(name="access_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'access_user_id', type: 'integer', nullable: true)] protected int $accessUserId; - /** - * @ORM\Column(name="access_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'access_date', type: 'datetime', nullable: false)] protected DateTime $accessDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="access_tool", type="string", length=30, nullable=true) - */ + #[ORM\Column(name: 'access_tool', type: 'string', length: 30, nullable: true)] protected ?string $accessTool = null; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; - /** - * @ORM\Column(name="access_id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'access_id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $accessId; /** diff --git a/src/CoreBundle/Entity/TrackELinks.php b/src/CoreBundle/Entity/TrackELinks.php index bf3e1f780b..82aaeaca7d 100644 --- a/src/CoreBundle/Entity/TrackELinks.php +++ b/src/CoreBundle/Entity/TrackELinks.php @@ -11,46 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackELinks. - * - * @ORM\Table(name="track_e_links", indexes={ - * @ORM\Index(name="idx_tel_c_id", columns={"c_id"}), - * @ORM\Index(name="idx_tel_user_id", columns={"links_user_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_links')] +#[ORM\Index(name: 'idx_tel_c_id', columns: ['c_id'])] +#[ORM\Index(name: 'idx_tel_user_id', columns: ['links_user_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackELinks { - /** - * @ORM\Column(name="links_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'links_user_id', type: 'integer', nullable: true)] protected ?int $linksUserId = null; - /** - * @ORM\Column(name="links_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'links_date', type: 'datetime', nullable: false)] protected DateTime $linksDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="links_link_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'links_link_id', type: 'integer', nullable: false)] protected int $linksLinkId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="links_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'links_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $linksId; /** diff --git a/src/CoreBundle/Entity/TrackELogin.php b/src/CoreBundle/Entity/TrackELogin.php index a35fe0991e..46372e7a86 100644 --- a/src/CoreBundle/Entity/TrackELogin.php +++ b/src/CoreBundle/Entity/TrackELogin.php @@ -11,41 +11,29 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackELogin. - * - * @ORM\Table(name="track_e_login", indexes={ - * @ORM\Index(name="login_user_id", columns={"login_user_id"}), - * @ORM\Index(name="idx_track_e_login_date", columns={"login_date"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_login')] +#[ORM\Index(name: 'login_user_id', columns: ['login_user_id'])] +#[ORM\Index(name: 'idx_track_e_login_date', columns: ['login_date'])] +#[ORM\Entity] class TrackELogin { - /** - * @ORM\Column(name="login_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'login_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $loginId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="logins") - * @ORM\JoinColumn(name="login_user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'logins')] + #[ORM\JoinColumn(name: 'login_user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="login_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'login_date', type: 'datetime', nullable: false)] protected DateTime $loginDate; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; - /** - * @ORM\Column(name="logout_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'logout_date', type: 'datetime', nullable: true)] protected ?DateTime $logoutDate = null; public function getUser(): User @@ -103,10 +91,8 @@ class TrackELogin /** * Get logoutDate. - * - * @return null|DateTime */ - public function getLogoutDate() + public function getLogoutDate(): ?\DateTime { return $this->logoutDate; } diff --git a/src/CoreBundle/Entity/TrackELoginRecord.php b/src/CoreBundle/Entity/TrackELoginRecord.php index 1bef24417b..f3e8d53524 100644 --- a/src/CoreBundle/Entity/TrackELoginRecord.php +++ b/src/CoreBundle/Entity/TrackELoginRecord.php @@ -11,37 +11,26 @@ use Doctrine\ORM\Mapping as ORM; /** * Track Login Record. - * - * @ORM\Table(name="track_e_login_record") - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_login_record')] +#[ORM\Entity] class TrackELoginRecord { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $id; - /** - * @ORM\Column(name="username", type="string", length=100, nullable=false) - */ + #[ORM\Column(name: 'username', type: 'string', length: 100, nullable: false)] protected string $username; - /** - * @ORM\Column(name="login_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'login_date', type: 'datetime', nullable: false)] protected DateTime $loginDate; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; - /** - * @ORM\Column(name="success", type="boolean") - */ + #[ORM\Column(name: 'success', type: 'boolean')] protected bool $success; /** diff --git a/src/CoreBundle/Entity/TrackEOnline.php b/src/CoreBundle/Entity/TrackEOnline.php index 1a65a00a24..a4c644a9a2 100644 --- a/src/CoreBundle/Entity/TrackEOnline.php +++ b/src/CoreBundle/Entity/TrackEOnline.php @@ -11,54 +11,35 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEOnline. - * - * @ORM\Table( - * name="track_e_online", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="login_user_id", columns={"login_user_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_online')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'login_user_id', columns: ['login_user_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackEOnline { - /** - * @ORM\Column(name="login_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'login_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $loginId; - /** - * @ORM\Column(name="login_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'login_user_id', type: 'integer', nullable: false)] protected int $loginUserId; - /** - * @ORM\Column(name="login_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'login_date', type: 'datetime', nullable: false)] protected DateTime $loginDate; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="access_url_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'access_url_id', type: 'integer', nullable: false)] protected int $accessUrlId; /** diff --git a/src/CoreBundle/Entity/TrackEUploads.php b/src/CoreBundle/Entity/TrackEUploads.php index 1b67513749..2cd6f547c6 100644 --- a/src/CoreBundle/Entity/TrackEUploads.php +++ b/src/CoreBundle/Entity/TrackEUploads.php @@ -11,49 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * TrackEUploads. - * - * @ORM\Table( - * name="track_e_uploads", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="upload_user_id", columns={"upload_user_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'track_e_uploads')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'upload_user_id', columns: ['upload_user_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class TrackEUploads { - /** - * @ORM\Column(name="upload_id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'upload_id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected int $uploadId; - /** - * @ORM\Column(name="upload_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'upload_user_id', type: 'integer', nullable: true)] protected ?int $uploadUserId = null; - /** - * @ORM\Column(name="upload_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'upload_date', type: 'datetime', nullable: false)] protected DateTime $uploadDate; - /** - * @ORM\Column(name="c_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: true)] protected ?int $cId = null; - /** - * @ORM\Column(name="upload_work_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'upload_work_id', type: 'integer', nullable: false)] protected int $uploadWorkId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; /** diff --git a/src/CoreBundle/Entity/User.php b/src/CoreBundle/Entity/User.php index 09c5a20264..7cc5ed193c 100644 --- a/src/CoreBundle/Entity/User.php +++ b/src/CoreBundle/Entity/User.php @@ -12,6 +12,8 @@ use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiSubresource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; +use Chamilo\CoreBundle\Entity\Listener\UserListener; +use Chamilo\CoreBundle\Repository\Node\UserRepository; use Chamilo\CoreBundle\Traits\UserCreatorTrait; use Chamilo\CourseBundle\Entity\CGroupRelTutor; use Chamilo\CourseBundle\Entity\CGroupRelUser; @@ -37,16 +39,6 @@ use UserManager; /** * EquatableInterface is needed to check if the user needs to be refreshed. - * - * @ORM\Table( - * name="user", - * indexes={ - * @ORM\Index(name="status", columns={"status"}) - * } - * ) - * @UniqueEntity("username") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\UserRepository") - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\UserListener"}) */ #[ApiResource( collectionOperations: [ @@ -85,7 +77,12 @@ use UserManager; 'lastname' => 'partial', ])] #[ApiFilter(BooleanFilter::class, properties: ['isActive'])] -class User implements UserInterface, EquatableInterface, ResourceInterface, ResourceIllustrationInterface, PasswordAuthenticatedUserInterface, LegacyPasswordAuthenticatedUserInterface, ExtraFieldItemInterface +#[ORM\Table(name: 'user')] +#[ORM\Index(name: 'status', columns: ['status'])] +#[UniqueEntity('username')] +#[ORM\Entity(repositoryClass: UserRepository::class)] +#[ORM\EntityListeners([UserListener::class])] +class User implements UserInterface, EquatableInterface, ResourceInterface, ResourceIllustrationInterface, PasswordAuthenticatedUserInterface, LegacyPasswordAuthenticatedUserInterface, ExtraFieldItemInterface, \Stringable { use TimestampableEntity; use UserCreatorTrait; @@ -96,19 +93,14 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso public const ANONYMOUS = 6; /*public const COURSE_MANAGER = 1; - public const TEACHER = 1; - public const SESSION_ADMIN = 3; - public const DRH = 4; - public const STUDENT = 5; - public const ANONYMOUS = 6;*/ - - /** - * @ORM\OneToOne( - * targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", cascade={"remove"}, orphanRemoval=true - * ) - * @ORM\JoinColumn(name="resource_node_id", onDelete="CASCADE") - */ + public const TEACHER = 1; + public const SESSION_ADMIN = 3; + public const DRH = 4; + public const STUDENT = 5; + public const ANONYMOUS = 6;*/ #[Groups(['user_json:read'])] + #[ORM\OneToOne(targetEntity: ResourceNode::class, cascade: ['remove'], orphanRemoval: true)] + #[ORM\JoinColumn(name: 'resource_node_id', onDelete: 'CASCADE')] public ?ResourceNode $resourceNode = null; /** @@ -131,11 +123,6 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso ])] public ?string $illustrationUrl = null; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue() - */ #[Groups([ 'user:read', 'course:read', @@ -144,11 +131,11 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso 'message:read', 'user_rel_user:read', ])] + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="username", type="string", length=100, unique=true) - */ #[Assert\NotBlank] #[Groups([ 'user_export', @@ -162,16 +149,14 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso 'user_rel_user:read', 'social_post:read', ])] + #[ORM\Column(name: 'username', type: 'string', length: 100, unique: true)] protected string $username; - /** - * @ORM\Column(name="api_token", type="string", unique=true, nullable=true) - */ + #[ORM\Column(name: 'api_token', type: 'string', unique: true, nullable: true)] protected ?string $apiToken = null; /** * @ApiProperty(iri="http://schema.org/name") - * @ORM\Column(name="firstname", type="string", length=64, nullable=true) */ #[Assert\NotBlank] #[Groups([ @@ -180,161 +165,115 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso 'resource_node:read', 'user_json:read', ])] + #[ORM\Column(name: 'firstname', type: 'string', length: 64, nullable: true)] protected ?string $firstname = null; - /** - * @ORM\Column(name="lastname", type="string", length=64, nullable=true) - */ #[Groups([ 'user:read', 'user:write', 'resource_node:read', 'user_json:read', ])] + #[ORM\Column(name: 'lastname', type: 'string', length: 64, nullable: true)] protected ?string $lastname = null; - /** - * @ORM\Column(name="website", type="string", length=255, nullable=true) - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'website', type: 'string', length: 255, nullable: true)] protected ?string $website; - /** - * @ORM\Column(name="biography", type="text", nullable=true) - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'biography', type: 'text', nullable: true)] protected ?string $biography; - /** - * @ORM\Column(name="locale", type="string", length=10) - */ #[Groups(['user:read', 'user:write', 'user_json:read'])] + #[ORM\Column(name: 'locale', type: 'string', length: 10)] protected string $locale; #[Groups(['user:write'])] protected ?string $plainPassword = null; - /** - * @ORM\Column(name="password", type="string", length=255) - */ + #[ORM\Column(name: 'password', type: 'string', length: 255)] protected string $password; - /** - * @ORM\Column(name="username_canonical", type="string", length=180) - */ + #[ORM\Column(name: 'username_canonical', type: 'string', length: 180)] protected string $usernameCanonical; - /** - * @ORM\Column(name="timezone", type="string", length=64) - */ #[Groups(['user:read', 'user:write', 'user_json:read'])] + #[ORM\Column(name: 'timezone', type: 'string', length: 64)] protected string $timezone; - /** - * @ORM\Column(name="email_canonical", type="string", length=100) - */ + #[ORM\Column(name: 'email_canonical', type: 'string', length: 100)] protected string $emailCanonical; - /** - * @ORM\Column(name="email", type="string", length=100) - */ #[Groups(['user:read', 'user:write', 'user_json:read'])] #[Assert\NotBlank] #[Assert\Email] + #[ORM\Column(name: 'email', type: 'string', length: 100)] protected string $email; - /** - * @ORM\Column(name="locked", type="boolean") - */ + #[ORM\Column(name: 'locked', type: 'boolean')] protected bool $locked; - /** - * @ORM\Column(name="enabled", type="boolean") - */ #[Groups(['user:read', 'user:write'])] #[Assert\NotNull] + #[ORM\Column(name: 'enabled', type: 'boolean')] protected bool $enabled; - /** - * @ORM\Column(name="expired", type="boolean") - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'expired', type: 'boolean')] protected bool $expired; - /** - * @ORM\Column(name="credentials_expired", type="boolean") - */ + #[ORM\Column(name: 'credentials_expired', type: 'boolean')] protected bool $credentialsExpired; - /** - * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'credentials_expire_at', type: 'datetime', nullable: true)] protected ?DateTime $credentialsExpireAt; - /** - * @ORM\Column(name="date_of_birth", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'date_of_birth', type: 'datetime', nullable: true)] protected ?DateTime $dateOfBirth; - /** - * @ORM\Column(name="expires_at", type="datetime", nullable=true) - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'expires_at', type: 'datetime', nullable: true)] protected ?DateTime $expiresAt; - /** - * @ORM\Column(name="phone", type="string", length=64, nullable=true) - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'phone', type: 'string', length: 64, nullable: true)] protected ?string $phone = null; - /** - * @ORM\Column(name="address", type="string", length=250, nullable=true) - */ #[Groups(['user:read', 'user:write'])] + #[ORM\Column(name: 'address', type: 'string', length: 250, nullable: true)] protected ?string $address = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: 'string', length: 255)] protected string $salt; - /** - * @ORM\Column(name="gender", type="string", length=1, nullable=true) - */ + #[ORM\Column(name: 'gender', type: 'string', length: 1, nullable: true)] protected ?string $gender = null; - /** - * @ORM\Column(name="last_login", type="datetime", nullable=true) - */ #[Groups(['user:read'])] + #[ORM\Column(name: 'last_login', type: 'datetime', nullable: true)] protected ?DateTime $lastLogin = null; /** * Random string sent to the user email address in order to verify it. - * - * @ORM\Column(name="confirmation_token", type="string", length=255, nullable=true) */ + #[ORM\Column(name: 'confirmation_token', type: 'string', length: 255, nullable: true)] protected ?string $confirmationToken = null; - /** - * @ORM\Column(name="password_requested_at", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'password_requested_at', type: 'datetime', nullable: true)] protected ?DateTime $passwordRequestedAt; /** * @var Collection|CourseRelUser[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="user", orphanRemoval=true) */ #[ApiSubresource] + #[ORM\OneToMany(targetEntity: CourseRelUser::class, mappedBy: 'user', orphanRemoval: true)] protected Collection $courses; /** * @var Collection|UsergroupRelUser[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelUser", mappedBy="user") */ + #[ORM\OneToMany(targetEntity: UsergroupRelUser::class, mappedBy: 'user')] protected Collection $classes; /** @@ -350,36 +289,28 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * An array of roles. Example: ROLE_USER, ROLE_TEACHER, ROLE_ADMIN. * - * @ORM\Column(type="array") * * @var mixed[]|string[] */ #[Groups(['user:read', 'user:write', 'user_json:read'])] + #[ORM\Column(type: 'array')] protected array $roles = []; - /** - * @ORM\Column(name="profile_completed", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'profile_completed', type: 'boolean', nullable: true)] protected ?bool $profileCompleted = null; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\JuryMembers", mappedBy="user") + * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\JuryMembers", mappedBy="user") */ //protected $jurySubscriptions; /** * @var Collection|Group[] - * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\Group", inversedBy="users") - * @ORM\JoinTable( - * name="fos_user_user_group", - * joinColumns={ - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="cascade") - * }, - * inverseJoinColumns={ - * @ORM\JoinColumn(name="group_id", referencedColumnName="id") - * } - * ) */ + #[ORM\JoinTable(name: 'fos_user_user_group')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'cascade')] + #[ORM\InverseJoinColumn(name: 'group_id', referencedColumnName: 'id')] + #[ORM\ManyToMany(targetEntity: Group::class, inversedBy: 'users')] protected Collection $groups; /** @@ -391,334 +322,224 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @var AccessUrlRelUser[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUser", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: AccessUrlRelUser::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $portals; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="creator") - * * @var Collection|ResourceNode[] */ + #[ORM\OneToMany(targetEntity: ResourceNode::class, mappedBy: 'creator')] protected Collection $resourceNodes; /** * @var Collection|SessionRelCourseRelUser[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser", - * mappedBy="user", - * cascade={"persist"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: SessionRelCourseRelUser::class, mappedBy: 'user', cascade: ['persist'], orphanRemoval: true)] protected Collection $sessionRelCourseRelUsers; /** * @var Collection|SessionRelUser[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SessionRelUser", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: SessionRelUser::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $sessionsRelUser; /** * @var Collection|SkillRelUser[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: SkillRelUser::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $achievedSkills; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\SkillRelUserComment", - * mappedBy="feedbackGiver", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) - * * @var Collection|SkillRelUserComment[] */ + #[ORM\OneToMany(targetEntity: SkillRelUserComment::class, mappedBy: 'feedbackGiver', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $commentedUserSkills; /** * @var Collection|GradebookCategory[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="user") */ + #[ORM\OneToMany(targetEntity: GradebookCategory::class, mappedBy: 'user')] protected Collection $gradeBookCategories; /** * @var Collection|GradebookCertificate[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\GradebookCertificate", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: GradebookCertificate::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookCertificates; /** * @var Collection|GradebookComment[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookComment", mappedBy="user") */ + #[ORM\OneToMany(targetEntity: GradebookComment::class, mappedBy: 'user')] protected Collection $gradeBookComments; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true - * ) - * * @var Collection|GradebookEvaluation[] */ + #[ORM\OneToMany(targetEntity: GradebookEvaluation::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookEvaluations; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) - * * @var Collection|GradebookLink[] */ + #[ORM\OneToMany(targetEntity: GradebookLink::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookLinks; /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookResult", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) - * * @var Collection|GradebookResult[] */ + #[ORM\OneToMany(targetEntity: GradebookResult::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookResults; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\GradebookResultLog", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true - * ) - * * @var Collection|GradebookResultLog[] */ + #[ORM\OneToMany(targetEntity: GradebookResultLog::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookResultLogs; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\GradebookScoreLog", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true - * ) - * * @var Collection|GradebookScoreLog[] */ + #[ORM\OneToMany(targetEntity: GradebookScoreLog::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookScoreLogs; /** * @var Collection|UserRelUser[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserRelUser", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY") */ + #[ORM\OneToMany(targetEntity: UserRelUser::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true, fetch: 'EXTRA_LAZY')] protected Collection $friends; /** * @var Collection|UserRelUser[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserRelUser", mappedBy="friend", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EXTRA_LAZY") */ + #[ORM\OneToMany(targetEntity: UserRelUser::class, mappedBy: 'friend', cascade: ['persist', 'remove'], orphanRemoval: true, fetch: 'EXTRA_LAZY')] protected Collection $friendsWithMe; /** * @var Collection|GradebookLinkevalLog[] - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\GradebookLinkevalLog", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: GradebookLinkevalLog::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $gradeBookLinkEvalLogs; /** * @var Collection|SequenceValue[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SequenceValue", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: SequenceValue::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $sequenceValues; /** * @var Collection|TrackEExerciseConfirmation[] - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\TrackEExerciseConfirmation", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: TrackEExerciseConfirmation::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $trackEExerciseConfirmations; /** * @var Collection|TrackEAttempt[] - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\TrackEAccessComplete", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: TrackEAccessComplete::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $trackEAccessCompleteList; /** * @var Collection|Templates[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Templates", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: Templates::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $templates; /** * @var Collection|TrackEAttempt[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: TrackEAttempt::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $trackEAttempts; /** - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\TrackECourseAccess", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) - * * @var Collection|TrackECourseAccess[] */ + #[ORM\OneToMany(targetEntity: TrackECourseAccess::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $trackECourseAccess; /** * @var Collection|UserCourseCategory[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\UserCourseCategory", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: UserCourseCategory::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $userCourseCategories; /** * @var Collection|UserRelCourseVote[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserRelCourseVote", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: UserRelCourseVote::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $userRelCourseVotes; /** * @var Collection|UserRelTag[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserRelTag", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: UserRelTag::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $userRelTags; /** * @var Collection|PersonalAgenda[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\PersonalAgenda", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: PersonalAgenda::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $personalAgendas; /** * @var CGroupRelUser[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: CGroupRelUser::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $courseGroupsAsMember; /** * @var CGroupRelTutor[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user", orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: CGroupRelTutor::class, mappedBy: 'user', orphanRemoval: true)] protected Collection $courseGroupsAsTutor; - /** - * @ORM\Column(name="auth_source", type="string", length=50, nullable=true) - */ + #[ORM\Column(name: 'auth_source', type: 'string', length: 50, nullable: true)] protected ?string $authSource; - /** - * @ORM\Column(name="status", type="integer") - */ + #[ORM\Column(name: 'status', type: 'integer')] protected int $status; - /** - * @ORM\Column(name="official_code", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'official_code', type: 'string', length: 40, nullable: true)] protected ?string $officialCode = null; - /** - * @ORM\Column(name="picture_uri", type="string", length=250, nullable=true) - */ + #[ORM\Column(name: 'picture_uri', type: 'string', length: 250, nullable: true)] protected ?string $pictureUri = null; - /** - * @ORM\Column(name="creator_id", type="integer", nullable=true, unique=false) - */ + #[ORM\Column(name: 'creator_id', type: 'integer', nullable: true, unique: false)] protected ?int $creatorId = null; - /** - * @ORM\Column(name="competences", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'competences', type: 'text', nullable: true, unique: false)] protected ?string $competences = null; - /** - * @ORM\Column(name="diplomas", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'diplomas', type: 'text', nullable: true, unique: false)] protected ?string $diplomas = null; - /** - * @ORM\Column(name="openarea", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'openarea', type: 'text', nullable: true, unique: false)] protected ?string $openarea = null; - /** - * @ORM\Column(name="teach", type="text", nullable=true, unique=false) - */ + #[ORM\Column(name: 'teach', type: 'text', nullable: true, unique: false)] protected ?string $teach = null; - /** - * @ORM\Column(name="productions", type="string", length=250, nullable=true, unique=false) - */ + #[ORM\Column(name: 'productions', type: 'string', length: 250, nullable: true, unique: false)] protected ?string $productions = null; - /** - * @ORM\Column(name="registration_date", type="datetime") - */ + #[ORM\Column(name: 'registration_date', type: 'datetime')] protected DateTime $registrationDate; - /** - * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false) - */ + #[ORM\Column(name: 'expiration_date', type: 'datetime', nullable: true, unique: false)] protected ?DateTime $expirationDate = null; - /** - * @ORM\Column(name="active", type="boolean") - */ + #[ORM\Column(name: 'active', type: 'boolean')] protected bool $active; - /** - * @ORM\Column(name="openid", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'openid', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $openid = null; - /** - * @ORM\Column(name="theme", type="string", length=255, nullable=true, unique=false) - */ + #[ORM\Column(name: 'theme', type: 'string', length: 255, nullable: true, unique: false)] protected ?string $theme = null; - /** - * @ORM\Column(name="hr_dept_id", type="smallint", nullable=true, unique=false) - */ + #[ORM\Column(name: 'hr_dept_id', type: 'smallint', nullable: true, unique: false)] protected ?int $hrDeptId = null; #[Groups(['user:write'])] @@ -726,70 +547,41 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @var Collection|MessageTag[] - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\MessageTag", - * mappedBy="user", - * cascade={"persist", "remove"}, - * orphanRemoval="true" - * ) */ + #[ORM\OneToMany(targetEntity: MessageTag::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $messageTags; /** * @var Collection|Message[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\Message", - * mappedBy="sender", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: Message::class, mappedBy: 'sender', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $sentMessages; /** * @var Collection|MessageRelUser[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\MessageRelUser", - * mappedBy="receiver", - * cascade={"persist", "remove"} - * ) */ + #[ORM\OneToMany(targetEntity: MessageRelUser::class, mappedBy: 'receiver', cascade: ['persist', 'remove'])] protected Collection $receivedMessages; /** * @var Collection|CSurveyInvitation[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CSurveyInvitation", - * mappedBy = "user", - * cascade={"remove"} - * ) */ + #[ORM\OneToMany(targetEntity: CSurveyInvitation::class, mappedBy: 'user', cascade: ['remove'])] protected Collection $surveyInvitations; /** * @var Collection|TrackELogin[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\TrackELogin", - * mappedBy = "user", - * cascade={"remove"} - * ) */ + #[ORM\OneToMany(targetEntity: TrackELogin::class, mappedBy: 'user', cascade: ['remove'])] protected Collection $logins; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Admin", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) - */ + #[ORM\OneToOne(targetEntity: Admin::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)] protected ?Admin $admin = null; /** * @var null|NilUuid|UuidV4 - * - * @ORM\Column(type="uuid", unique=true) */ + #[ORM\Column(type: 'uuid', unique: true)] protected $uuid; // Property used only during installation. @@ -798,19 +590,13 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso #[Groups(['user:read', 'user_json:read', 'social_post:read', 'course:read'])] protected string $fullName; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SocialPost", mappedBy="sender", orphanRemoval=true) - */ + #[ORM\OneToMany(targetEntity: SocialPost::class, mappedBy: 'sender', orphanRemoval: true)] private Collection $sentSocialPosts; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SocialPost", mappedBy="userReceiver") - */ + #[ORM\OneToMany(targetEntity: SocialPost::class, mappedBy: 'userReceiver')] private Collection $receivedSocialPosts; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SocialPostFeedback", mappedBy="user", orphanRemoval=true) - */ + #[ORM\OneToMany(targetEntity: SocialPostFeedback::class, mappedBy: 'user', orphanRemoval: true)] private Collection $socialPostsFeedbacks; public function __construct() @@ -984,7 +770,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|ResourceNode[] $resourceNodes */ - public function setResourceNodes(Collection $resourceNodes): self + public function setResourceNodes(\Doctrine\Common\Collections\Collection|array $resourceNodes): self { $this->resourceNodes = $resourceNodes; @@ -1021,7 +807,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|CourseRelUser[] $courses */ - public function setCourses(Collection $courses): self + public function setCourses(\Doctrine\Common\Collections\Collection|array $courses): self { $this->courses = $courses; @@ -1101,7 +887,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|UsergroupRelUser[] $classes */ - public function setClasses(Collection $classes): self + public function setClasses(\Doctrine\Common\Collections\Collection|array $classes): self { $this->classes = $classes; @@ -1658,7 +1444,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|SkillRelUser[] $value */ - public function setAchievedSkills(Collection $value): self + public function setAchievedSkills(\Doctrine\Common\Collections\Collection|array $value): self { $this->achievedSkills = $value; @@ -1701,7 +1487,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param AccessUrlRelUser[]|Collection $value */ - public function setPortals(Collection $value): void + public function setPortals(array|\Doctrine\Common\Collections\Collection $value): void { $this->portals = $value; } @@ -1724,7 +1510,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|SkillRelUserComment[] $commentedUserSkills */ - public function setCommentedUserSkills(Collection $commentedUserSkills): self + public function setCommentedUserSkills(\Doctrine\Common\Collections\Collection|array $commentedUserSkills): self { $this->commentedUserSkills = $commentedUserSkills; @@ -2021,7 +1807,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param Collection|GradebookCertificate[] $gradeBookCertificates */ - public function setGradeBookCertificates(Collection $gradeBookCertificates): self + public function setGradeBookCertificates(\Doctrine\Common\Collections\Collection|array $gradeBookCertificates): self { $this->gradeBookCertificates = $gradeBookCertificates; @@ -2051,7 +1837,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookCategory[]|Collection */ - public function getGradeBookCategories() + public function getGradeBookCategories(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookCategories; } @@ -2059,7 +1845,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookComment[]|Collection */ - public function getGradeBookComments() + public function getGradeBookComments(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookComments; } @@ -2067,7 +1853,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookEvaluation[]|Collection */ - public function getGradeBookEvaluations() + public function getGradeBookEvaluations(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookEvaluations; } @@ -2075,7 +1861,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookLink[]|Collection */ - public function getGradeBookLinks() + public function getGradeBookLinks(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookLinks; } @@ -2083,7 +1869,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookResult[]|Collection */ - public function getGradeBookResults() + public function getGradeBookResults(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookResults; } @@ -2091,7 +1877,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookResultLog[]|Collection */ - public function getGradeBookResultLogs() + public function getGradeBookResultLogs(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookResultLogs; } @@ -2099,7 +1885,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookScoreLog[]|Collection */ - public function getGradeBookScoreLogs() + public function getGradeBookScoreLogs(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookScoreLogs; } @@ -2107,7 +1893,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return GradebookLinkevalLog[]|Collection */ - public function getGradeBookLinkEvalLogs() + public function getGradeBookLinkEvalLogs(): array|\Doctrine\Common\Collections\Collection { return $this->gradeBookLinkEvalLogs; } @@ -2115,7 +1901,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return UserRelCourseVote[]|Collection */ - public function getUserRelCourseVotes() + public function getUserRelCourseVotes(): array|\Doctrine\Common\Collections\Collection { return $this->userRelCourseVotes; } @@ -2123,7 +1909,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return UserRelTag[]|Collection */ - public function getUserRelTags() + public function getUserRelTags(): array|\Doctrine\Common\Collections\Collection { return $this->userRelTags; } @@ -2131,7 +1917,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return PersonalAgenda[]|Collection */ - public function getPersonalAgendas() + public function getPersonalAgendas(): array|\Doctrine\Common\Collections\Collection { return $this->personalAgendas; } @@ -2139,7 +1925,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return Collection|mixed[] */ - public function getCurriculumItems() + public function getCurriculumItems(): \Doctrine\Common\Collections\Collection|array { return $this->curriculumItems; } @@ -2147,7 +1933,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return UserRelUser[]|Collection */ - public function getFriends() + public function getFriends(): array|\Doctrine\Common\Collections\Collection { return $this->friends; } @@ -2170,7 +1956,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return UserRelUser[]|Collection */ - public function getFriendsWithMe() + public function getFriendsWithMe(): array|\Doctrine\Common\Collections\Collection { return $this->friendsWithMe; } @@ -2195,7 +1981,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return Templates[]|Collection */ - public function getTemplates() + public function getTemplates(): array|\Doctrine\Common\Collections\Collection { return $this->templates; } @@ -2203,7 +1989,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return ArrayCollection|Collection */ - public function getDropBoxReceivedFiles() + public function getDropBoxReceivedFiles(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->dropBoxReceivedFiles; } @@ -2211,7 +1997,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return SequenceValue[]|Collection */ - public function getSequenceValues() + public function getSequenceValues(): array|\Doctrine\Common\Collections\Collection { return $this->sequenceValues; } @@ -2219,7 +2005,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return TrackEExerciseConfirmation[]|Collection */ - public function getTrackEExerciseConfirmations() + public function getTrackEExerciseConfirmations(): array|\Doctrine\Common\Collections\Collection { return $this->trackEExerciseConfirmations; } @@ -2227,7 +2013,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return TrackEAttempt[]|Collection */ - public function getTrackEAccessCompleteList() + public function getTrackEAccessCompleteList(): array|\Doctrine\Common\Collections\Collection { return $this->trackEAccessCompleteList; } @@ -2235,7 +2021,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return TrackEAttempt[]|Collection */ - public function getTrackEAttempts() + public function getTrackEAttempts(): array|\Doctrine\Common\Collections\Collection { return $this->trackEAttempts; } @@ -2243,7 +2029,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return TrackECourseAccess[]|Collection */ - public function getTrackECourseAccess() + public function getTrackECourseAccess(): array|\Doctrine\Common\Collections\Collection { return $this->trackECourseAccess; } @@ -2251,7 +2037,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return UserCourseCategory[]|Collection */ - public function getUserCourseCategories() + public function getUserCourseCategories(): array|\Doctrine\Common\Collections\Collection { return $this->userCourseCategories; } @@ -2279,7 +2065,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return SessionRelUser[]|Collection */ - public function getSessionsRelUser() + public function getSessionsRelUser(): array|\Doctrine\Common\Collections\Collection { return $this->sessionsRelUser; } @@ -2413,7 +2199,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return SessionRelCourseRelUser[]|Collection */ - public function getSessionRelCourseRelUsers() + public function getSessionRelCourseRelUsers(): array|\Doctrine\Common\Collections\Collection { return $this->sessionRelCourseRelUsers; } @@ -2421,7 +2207,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param SessionRelCourseRelUser[]|Collection $sessionRelCourseRelUsers */ - public function setSessionRelCourseRelUsers($sessionRelCourseRelUsers): self + public function setSessionRelCourseRelUsers(array|\Doctrine\Common\Collections\Collection $sessionRelCourseRelUsers): self { $this->sessionRelCourseRelUsers = $sessionRelCourseRelUsers; @@ -2443,7 +2229,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return CSurveyInvitation[]|Collection */ - public function getSurveyInvitations() + public function getSurveyInvitations(): array|\Doctrine\Common\Collections\Collection { return $this->surveyInvitations; } @@ -2458,7 +2244,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return TrackELogin[]|Collection */ - public function getLogins() + public function getLogins(): array|\Doctrine\Common\Collections\Collection { return $this->logins; } @@ -2473,7 +2259,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @return MessageTag[]|Collection */ - public function getMessageTags() + public function getMessageTags(): array|\Doctrine\Common\Collections\Collection { return $this->messageTags; } @@ -2481,7 +2267,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso /** * @param MessageTag[]|Collection $messageTags */ - public function setMessageTags($messageTags): self + public function setMessageTags(array|\Doctrine\Common\Collections\Collection $messageTags): self { $this->messageTags = $messageTags; @@ -2511,9 +2297,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso ? 0 : max( $categoryCourses->map( - function ($courseRelUser) { - return $courseRelUser->getSort(); - } + fn ($courseRelUser) => $courseRelUser->getSort() )->toArray() ); } diff --git a/src/CoreBundle/Entity/UserApiKey.php b/src/CoreBundle/Entity/UserApiKey.php index 91069a5995..3cb79aeb69 100644 --- a/src/CoreBundle/Entity/UserApiKey.php +++ b/src/CoreBundle/Entity/UserApiKey.php @@ -11,59 +11,39 @@ use Doctrine\ORM\Mapping as ORM; /** * UserApiKey. - * - * @ORM\Table(name="user_api_key", indexes={ - * @ORM\Index(name="idx_user_api_keys_user", columns={"user_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'user_api_key')] +#[ORM\Index(name: 'idx_user_api_keys_user', columns: ['user_id'])] +#[ORM\Entity] class UserApiKey { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'user_id', type: 'integer', nullable: false)] protected int $userId; - /** - * @ORM\Column(name="api_key", type="string", length=32, nullable=false) - */ + #[ORM\Column(name: 'api_key', type: 'string', length: 32, nullable: false)] protected string $apiKey; - /** - * @ORM\Column(name="api_service", type="string", length=10, nullable=false) - */ + #[ORM\Column(name: 'api_service', type: 'string', length: 10, nullable: false)] protected string $apiService; - /** - * @ORM\Column(name="api_end_point", type="text", nullable=true) - */ + #[ORM\Column(name: 'api_end_point', type: 'text', nullable: true)] protected ?string $apiEndPoint = null; - /** - * @ORM\Column(name="created_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'created_date', type: 'datetime', nullable: true)] protected ?DateTime $createdDate = null; - /** - * @ORM\Column(name="validity_start_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'validity_start_date', type: 'datetime', nullable: true)] protected ?DateTime $validityStartDate = null; - /** - * @ORM\Column(name="validity_end_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'validity_end_date', type: 'datetime', nullable: true)] protected ?DateTime $validityEndDate = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** diff --git a/src/CoreBundle/Entity/UserCareer.php b/src/CoreBundle/Entity/UserCareer.php index 00ddf934b5..1ba6ba5d42 100644 --- a/src/CoreBundle/Entity/UserCareer.php +++ b/src/CoreBundle/Entity/UserCareer.php @@ -9,33 +9,23 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Timestampable\Traits\TimestampableEntity; -/** - * @ORM\Table(name="user_career") - * @ORM\Entity - */ +#[ORM\Table(name: 'user_career')] +#[ORM\Entity] class UserCareer { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'user_id', type: 'integer', nullable: false)] protected User $user; - /** - * @ORM\Column(name="career_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'career_id', type: 'integer', nullable: false)] protected Career $career; - /** - * @ORM\Column(name="extra_data", type="text", nullable=true) - */ + #[ORM\Column(name: 'extra_data', type: 'text', nullable: true)] protected string $extraData; } diff --git a/src/CoreBundle/Entity/UserCourseCategory.php b/src/CoreBundle/Entity/UserCourseCategory.php index 08d9603265..1acc9a378d 100644 --- a/src/CoreBundle/Entity/UserCourseCategory.php +++ b/src/CoreBundle/Entity/UserCourseCategory.php @@ -11,42 +11,30 @@ use Doctrine\ORM\Mapping as ORM; /** * UserCourseCategory. - * - * @ORM\Table(name="user_course_category", indexes={ - * @ORM\Index(name="idx_user_c_cat_uid", columns={"user_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'user_course_category')] +#[ORM\Index(name: 'idx_user_c_cat_uid', columns: ['user_id'])] +#[ORM\Entity] class UserCourseCategory { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="userCourseCategories") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'userCourseCategories')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="sort", type="integer", nullable=true) - */ + #[ORM\Column(name: 'sort', type: 'integer', nullable: true)] protected ?int $sort = null; - /** - * @ORM\Column(name="collapsed", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'collapsed', type: 'boolean', nullable: true)] protected ?bool $isCollapsed = null; /** diff --git a/src/CoreBundle/Entity/UserFriendRelationType.php b/src/CoreBundle/Entity/UserFriendRelationType.php index b1c964d4a7..c9a8d43d53 100644 --- a/src/CoreBundle/Entity/UserFriendRelationType.php +++ b/src/CoreBundle/Entity/UserFriendRelationType.php @@ -10,22 +10,17 @@ use Doctrine\ORM\Mapping as ORM; /** * UserFriendRelationType. - * - * @ORM\Table(name="user_friend_relation_type") - * @ORM\Entity */ +#[ORM\Table(name: 'user_friend_relation_type')] +#[ORM\Entity] class UserFriendRelationType { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=20, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 20, nullable: false)] protected string $title; /** diff --git a/src/CoreBundle/Entity/UserGroupRelUserGroup.php b/src/CoreBundle/Entity/UserGroupRelUserGroup.php index 71f12c0508..a481f2b6ff 100644 --- a/src/CoreBundle/Entity/UserGroupRelUserGroup.php +++ b/src/CoreBundle/Entity/UserGroupRelUserGroup.php @@ -10,32 +10,23 @@ use Doctrine\ORM\Mapping as ORM; /** * GroupRelGroup. - * - * @ORM\Table(name="usergroup_rel_usergroup") - * @ORM\Entity */ +#[ORM\Table(name: 'usergroup_rel_usergroup')] +#[ORM\Entity] class UserGroupRelUserGroup { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="group_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'group_id', type: 'integer', nullable: false)] protected int $groupId; - /** - * @ORM\Column(name="subgroup_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'subgroup_id', type: 'integer', nullable: false)] protected int $subgroupId; - /** - * @ORM\Column(name="relation_type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'relation_type', type: 'integer', nullable: false)] protected int $relationType; /** diff --git a/src/CoreBundle/Entity/UserRelCourseVote.php b/src/CoreBundle/Entity/UserRelCourseVote.php index 22965521e4..1340807f1d 100644 --- a/src/CoreBundle/Entity/UserRelCourseVote.php +++ b/src/CoreBundle/Entity/UserRelCourseVote.php @@ -11,52 +11,38 @@ use Doctrine\ORM\Mapping as ORM; /** * UserRelCourseVote. - * - * @ORM\Table(name="user_rel_course_vote", indexes={ - * @ORM\Index(name="idx_ucv_cid", columns={"c_id"}), - * @ORM\Index(name="idx_ucv_uid", columns={"user_id"}), - * @ORM\Index(name="idx_ucv_cuid", columns={"user_id", "c_id"}) - * }) - * @ORM\Entity */ +#[ORM\Table(name: 'user_rel_course_vote')] +#[ORM\Index(name: 'idx_ucv_cid', columns: ['c_id'])] +#[ORM\Index(name: 'idx_ucv_uid', columns: ['user_id'])] +#[ORM\Index(name: 'idx_ucv_cuid', columns: ['user_id', 'c_id'])] +#[ORM\Entity] class UserRelCourseVote { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="userRelCourseVotes") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'userRelCourseVotes')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\AccessUrl", inversedBy="courses") - * @ORM\JoinColumn(name="url_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrl::class, inversedBy: 'courses')] + #[ORM\JoinColumn(name: 'url_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected AccessUrl $url; - /** - * @ORM\Column(name="vote", type="integer", nullable=false) - */ + #[ORM\Column(name: 'vote', type: 'integer', nullable: false)] protected int $vote; /** diff --git a/src/CoreBundle/Entity/UserRelTag.php b/src/CoreBundle/Entity/UserRelTag.php index 2cba7a2378..7c1a6e2c16 100644 --- a/src/CoreBundle/Entity/UserRelTag.php +++ b/src/CoreBundle/Entity/UserRelTag.php @@ -11,37 +11,26 @@ use Doctrine\ORM\Mapping as ORM; /** * UserRelTag. - * - * @ORM\Table( - * name="user_rel_tag", - * indexes={ - * @ORM\Index(name="idx_urt_uid", columns={"user_id"}), - * @ORM\Index(name="idx_urt_tid", columns={"tag_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'user_rel_tag')] +#[ORM\Index(name: 'idx_urt_uid', columns: ['user_id'])] +#[ORM\Index(name: 'idx_urt_tid', columns: ['tag_id'])] +#[ORM\Entity] class UserRelTag { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="userRelTags", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'userRelTags', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tag", inversedBy="userRelTags", cascade={"persist"} ) - * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Tag::class, inversedBy: 'userRelTags', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Tag $tag; /** diff --git a/src/CoreBundle/Entity/UserRelUser.php b/src/CoreBundle/Entity/UserRelUser.php index 695cfbf861..156a3befc0 100644 --- a/src/CoreBundle/Entity/UserRelUser.php +++ b/src/CoreBundle/Entity/UserRelUser.php @@ -18,22 +18,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Associations between users. - * - * @ORM\Table(name="user_rel_user", - * uniqueConstraints={ - * @ORM\UniqueConstraint( - * name="user_friend_relation", - * columns={"user_id", "friend_user_id", "relation_type"} - * ) - * }, - * indexes={ - * @ORM\Index(name="idx_user_rel_user__user", columns={"user_id"}), - * @ORM\Index(name="idx_user_rel_user__friend_user", columns={"friend_user_id"}), - * @ORM\Index(name="idx_user_rel_user__user_friend_user", columns={"user_id", "friend_user_id"}) - * } - * ) - * @ORM\Entity - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\UserRelUserListener"}) */ #[ApiResource( collectionOperations: [ @@ -76,6 +60,13 @@ use Symfony\Component\Validator\Constraints as Assert; errorPath: 'User', message: 'User-friend relation already exists', )] +#[ORM\Table(name: 'user_rel_user')] +#[ORM\Index(name: 'idx_user_rel_user__user', columns: ['user_id'])] +#[ORM\Index(name: 'idx_user_rel_user__friend_user', columns: ['friend_user_id'])] +#[ORM\Index(name: 'idx_user_rel_user__user_friend_user', columns: ['user_id', 'friend_user_id'])] +#[ORM\UniqueConstraint(name: 'user_friend_relation', columns: ['user_id', 'friend_user_id', 'relation_type'])] +#[ORM\Entity] +#[ORM\EntityListeners([\Chamilo\CoreBundle\Entity\Listener\UserRelUserListener::class])] class UserRelUser { use UserTrait; @@ -93,34 +84,26 @@ class UserRelUser public const USER_RELATION_TYPE_HRM_REQUEST = 9; public const USER_RELATION_TYPE_FRIEND_REQUEST = 10; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="friends") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE", nullable=false) - */ #[Assert\NotNull] #[Groups(['user_rel_user:read', 'user_rel_user:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'friends')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="friendsWithMe") - * @ORM\JoinColumn(name="friend_user_id", referencedColumnName="id", onDelete="CASCADE", nullable=false) - */ #[Assert\NotNull] #[Groups(['user_rel_user:read', 'user_rel_user:write'])] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'friendsWithMe')] + #[ORM\JoinColumn(name: 'friend_user_id', referencedColumnName: 'id', onDelete: 'CASCADE', nullable: false)] protected User $friend; - /** - * @ORM\Column(name="relation_type", type="integer", nullable=false) - */ #[Assert\NotBlank] #[Groups(['user_rel_user:read', 'user_rel_user:write'])] + #[ORM\Column(name: 'relation_type', type: 'integer', nullable: false)] protected int $relationType; public function __construct() diff --git a/src/CoreBundle/Entity/Usergroup.php b/src/CoreBundle/Entity/Usergroup.php index 6f27e6a2a3..e860403825 100644 --- a/src/CoreBundle/Entity/Usergroup.php +++ b/src/CoreBundle/Entity/Usergroup.php @@ -15,9 +15,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Classes and social groups. - * - * @ORM\Table(name="usergroup") - * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\Node\UsergroupRepository") */ #[ApiResource( attributes: [ @@ -27,96 +24,76 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['usergroup:read'], ], )] -class Usergroup extends AbstractResource implements ResourceInterface, ResourceIllustrationInterface, ResourceWithAccessUrlInterface +#[ORM\Table(name: 'usergroup')] +#[ORM\Entity(repositoryClass: \Chamilo\CoreBundle\Repository\Node\UsergroupRepository::class)] +class Usergroup extends AbstractResource implements ResourceInterface, ResourceIllustrationInterface, ResourceWithAccessUrlInterface, \Stringable { use TimestampableEntity; public const SOCIAL_CLASS = 1; public const NORMAL_CLASS = 0; - /** - * @ORM\Column(name="id", type="integer", nullable=false) - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="group_type", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'group_type', type: 'integer', nullable: false)] protected int $groupType; - /** - * @ORM\Column(name="picture", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'picture', type: 'string', length: 255, nullable: true)] protected ?string $picture = null; - /** - * @ORM\Column(name="url", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'url', type: 'string', length: 255, nullable: true)] protected ?string $url = null; - /** - * @ORM\Column(name="visibility", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'visibility', type: 'string', length: 255, nullable: false)] protected string $visibility; - /** - * @ORM\Column(name="author_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'author_id', type: 'integer', nullable: true)] protected ?string $authorId = null; - /** - * @ORM\Column(name="allow_members_leave_group", type="integer") - */ #[Assert\NotBlank] + #[ORM\Column(name: 'allow_members_leave_group', type: 'integer')] protected int $allowMembersToLeaveGroup; /** * @var Collection|UsergroupRelUser[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelUser", mappedBy="usergroup", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\UsergroupRelUser::class, mappedBy: 'usergroup', cascade: ['persist'])] protected Collection $users; /** * @var Collection|UsergroupRelCourse[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelCourse", mappedBy="usergroup", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\UsergroupRelCourse::class, mappedBy: 'usergroup', cascade: ['persist'])] protected Collection $courses; /** * @var Collection|UsergroupRelSession[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelSession", mappedBy="usergroup", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\UsergroupRelSession::class, mappedBy: 'usergroup', cascade: ['persist'])] protected Collection $sessions; /** * @var Collection|UsergroupRelQuestion[] - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelQuestion", mappedBy="usergroup", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\UsergroupRelQuestion::class, mappedBy: 'usergroup', cascade: ['persist'])] protected Collection $questions; /** * @var AccessUrlRelUserGroup[]|Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUserGroup", - * mappedBy="userGroup", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CoreBundle\Entity\AccessUrlRelUserGroup::class, mappedBy: 'userGroup', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $urls; public function __construct() @@ -139,7 +116,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI /** * @return UsergroupRelUser[]|Collection */ - public function getUsers() + public function getUsers(): array|\Doctrine\Common\Collections\Collection { return $this->users; } @@ -147,7 +124,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI /** * @return AccessUrlRelUserGroup[]|Collection */ - public function getUrls() + public function getUrls(): array|\Doctrine\Common\Collections\Collection { return $this->urls; } @@ -296,7 +273,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI /** * @return UsergroupRelCourse[]|Collection */ - public function getCourses() + public function getCourses(): array|\Doctrine\Common\Collections\Collection { return $this->courses; } @@ -311,7 +288,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI /** * @return UsergroupRelSession[]|Collection */ - public function getSessions() + public function getSessions(): array|\Doctrine\Common\Collections\Collection { return $this->sessions; } @@ -326,7 +303,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI /** * @return UsergroupRelQuestion[]|Collection */ - public function getQuestions() + public function getQuestions(): array|\Doctrine\Common\Collections\Collection { return $this->questions; } diff --git a/src/CoreBundle/Entity/UsergroupRelCourse.php b/src/CoreBundle/Entity/UsergroupRelCourse.php index 237449b8a4..e7fcd29a58 100644 --- a/src/CoreBundle/Entity/UsergroupRelCourse.php +++ b/src/CoreBundle/Entity/UsergroupRelCourse.php @@ -8,29 +8,21 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="usergroup_rel_course") - * @ORM\Entity - */ +#[ORM\Table(name: 'usergroup_rel_course')] +#[ORM\Entity] class UsergroupRelCourse { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup", inversedBy="courses") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class, inversedBy: 'courses')] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Usergroup $usergroup; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="course_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; /** diff --git a/src/CoreBundle/Entity/UsergroupRelQuestion.php b/src/CoreBundle/Entity/UsergroupRelQuestion.php index a6878b715c..59ab27ea21 100644 --- a/src/CoreBundle/Entity/UsergroupRelQuestion.php +++ b/src/CoreBundle/Entity/UsergroupRelQuestion.php @@ -9,34 +9,24 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\CourseBundle\Entity\CQuizQuestion; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="usergroup_rel_question") - * @ORM\Entity - */ +#[ORM\Table(name: 'usergroup_rel_question')] +#[ORM\Entity] class UsergroupRelQuestion { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestion") - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuizQuestion::class)] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuizQuestion $question; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup", inversedBy="questions") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class, inversedBy: 'questions')] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Usergroup $usergroup; - /** - * @ORM\Column(name="coefficient", type="float", precision=6, scale=2, nullable=true) - */ + #[ORM\Column(name: 'coefficient', type: 'float', precision: 6, scale: 2, nullable: true)] protected ?float $coefficient = null; /** diff --git a/src/CoreBundle/Entity/UsergroupRelSession.php b/src/CoreBundle/Entity/UsergroupRelSession.php index 06d90b47bf..50fca70e72 100644 --- a/src/CoreBundle/Entity/UsergroupRelSession.php +++ b/src/CoreBundle/Entity/UsergroupRelSession.php @@ -8,29 +8,21 @@ namespace Chamilo\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="usergroup_rel_session") - * @ORM\Entity - */ +#[ORM\Table(name: 'usergroup_rel_session')] +#[ORM\Entity] class UsergroupRelSession { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup", inversedBy="sessions") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Usergroup::class, inversedBy: 'sessions')] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Usergroup $usergroup; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Session $session; /** diff --git a/src/CoreBundle/Entity/UsergroupRelUser.php b/src/CoreBundle/Entity/UsergroupRelUser.php index 4f962e39d4..f5ee8941d9 100644 --- a/src/CoreBundle/Entity/UsergroupRelUser.php +++ b/src/CoreBundle/Entity/UsergroupRelUser.php @@ -10,43 +10,29 @@ use Chamilo\CoreBundle\Traits\UserTrait; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="usergroup_rel_user", - * indexes={ - * @ORM\Index(name="IDX_739515A9A76ED395", columns={"user_id"}), - * @ORM\Index(name="IDX_739515A9D2112630", columns={"usergroup_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'usergroup_rel_user')] +#[ORM\Index(name: 'IDX_739515A9A76ED395', columns: ['user_id'])] +#[ORM\Index(name: 'IDX_739515A9D2112630', columns: ['usergroup_id'])] +#[ORM\Entity] class UsergroupRelUser { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="classes", cascade={"persist"}) - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'classes', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup", inversedBy="users", cascade={"persist"}) - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class, inversedBy: 'users', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Usergroup $usergroup; - /** - * @ORM\Column(name="relation_type", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'relation_type', type: 'integer', nullable: false)] protected int $relationType; /** diff --git a/src/CoreBundle/Traits/TimestampableAgoTrait.php b/src/CoreBundle/Traits/TimestampableAgoTrait.php index fb6232cdd0..87ba059f08 100644 --- a/src/CoreBundle/Traits/TimestampableAgoTrait.php +++ b/src/CoreBundle/Traits/TimestampableAgoTrait.php @@ -11,17 +11,13 @@ use Symfony\Component\Serializer\Annotation\Groups; trait TimestampableAgoTrait { - /** - * @Groups({"api"}) - */ + #[Groups(['api'])] public function getCreatedAtAgo(): string { return Carbon::instance($this->getCreatedAt())->diffForHumans(); } - /** - * @Groups({"api"}) - */ + #[Groups(['api'])] public function getUpdatedAtAgo(): string { return Carbon::instance($this->getUpdatedAt())->diffForHumans(); diff --git a/src/CoreBundle/Traits/TimestampableTypedEntity.php b/src/CoreBundle/Traits/TimestampableTypedEntity.php index 0fcdf711a6..9627a61740 100644 --- a/src/CoreBundle/Traits/TimestampableTypedEntity.php +++ b/src/CoreBundle/Traits/TimestampableTypedEntity.php @@ -12,20 +12,16 @@ use Symfony\Component\Serializer\Annotation\Groups; trait TimestampableTypedEntity { - /** - * @Gedmo\Timestampable(on="create") - * @ORM\Column(type="datetime") - */ #[ApiProperty] #[Groups(['timestampable_created:read'])] + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(type: 'datetime')] protected DateTime $createdAt; - /** - * @Gedmo\Timestampable(on="update") - * @ORM\Column(type="datetime") - */ #[ApiProperty] #[Groups(['timestampable_updated:read'])] + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(type: 'datetime')] protected DateTime $updatedAt; /** diff --git a/src/CourseBundle/Entity/CAnnouncement.php b/src/CourseBundle/Entity/CAnnouncement.php index f420a1b293..2a5afe4bf4 100644 --- a/src/CourseBundle/Entity/CAnnouncement.php +++ b/src/CourseBundle/Entity/CAnnouncement.php @@ -8,59 +8,42 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CAnnouncementRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="c_announcement") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CAnnouncementRepository") - */ -class CAnnouncement extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_announcement')] +#[ORM\Entity(repositoryClass: CAnnouncementRepository::class)] +class CAnnouncement extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content; - /** - * @ORM\Column(name="end_date", type="date", nullable=true) - */ + #[ORM\Column(name: 'end_date', type: 'date', nullable: true)] protected ?DateTime $endDate = null; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false)] protected int $displayOrder; - /** - * @ORM\Column(name="email_sent", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'email_sent', type: 'boolean', nullable: true)] protected ?bool $emailSent = null; /** * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CAnnouncementAttachment", - * mappedBy="announcement", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: CAnnouncementAttachment::class, mappedBy: 'announcement', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $attachments; public function __construct() diff --git a/src/CourseBundle/Entity/CAnnouncementAttachment.php b/src/CourseBundle/Entity/CAnnouncementAttachment.php index ae40fc8900..ea903770fb 100644 --- a/src/CourseBundle/Entity/CAnnouncementAttachment.php +++ b/src/CourseBundle/Entity/CAnnouncementAttachment.php @@ -12,43 +12,30 @@ use Doctrine\ORM\Mapping as ORM; /** * CAnnouncementAttachment. - * - * @ORM\Table(name="c_announcement_attachment") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository") */ -class CAnnouncementAttachment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_announcement_attachment')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository::class)] +class CAnnouncementAttachment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)] protected string $path; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="size", type="integer", nullable=false) - */ + #[ORM\Column(name: 'size', type: 'integer', nullable: false)] protected int $size; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAnnouncement", inversedBy="attachments", cascade={"persist"}) - * @ORM\JoinColumn(name="announcement_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CAnnouncement::class, inversedBy: 'attachments', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'announcement_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAnnouncement $announcement; - /** - * @ORM\Column(name="filename", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)] protected string $filename; public function __construct() diff --git a/src/CourseBundle/Entity/CAttendance.php b/src/CourseBundle/Entity/CAttendance.php index 8aeeb7b709..66764b25ca 100644 --- a/src/CourseBundle/Entity/CAttendance.php +++ b/src/CourseBundle/Entity/CAttendance.php @@ -13,83 +13,58 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_attendance", - * indexes={ - * @ORM\Index(name="active", columns={"active"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CAttendanceRepository") - */ -class CAttendance extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_attendance')] +#[ORM\Index(name: 'active', columns: ['active'])] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CAttendanceRepository::class)] +class CAttendance extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="active", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'active', type: 'integer', nullable: false)] protected int $active; - /** - * @ORM\Column(name="attendance_qualify_title", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'attendance_qualify_title', type: 'string', length: 255, nullable: true)] protected ?string $attendanceQualifyTitle = null; - /** - * @ORM\Column(name="attendance_qualify_max", type="integer", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'attendance_qualify_max', type: 'integer', nullable: false)] protected int $attendanceQualifyMax; - /** - * @ORM\Column(name="attendance_weight", type="float", precision=6, scale=2, nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'attendance_weight', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $attendanceWeight; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; /** * @var Collection|CAttendanceCalendar[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceCalendar", mappedBy="attendance", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CAttendanceCalendar::class, mappedBy: 'attendance', cascade: ['persist', 'remove'])] protected Collection $calendars; /** * @var Collection|CAttendanceResult[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceResult", mappedBy="attendance", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CAttendanceResult::class, mappedBy: 'attendance', cascade: ['persist', 'remove'])] protected Collection $results; /** * @var Collection|CAttendanceSheetLog[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceSheetLog", mappedBy="attendance", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CAttendanceSheetLog::class, mappedBy: 'attendance', cascade: ['persist', 'remove'])] protected Collection $logs; public function __construct() @@ -227,7 +202,7 @@ class CAttendance extends AbstractResource implements ResourceInterface /** * @return CAttendanceSheetLog[]|Collection */ - public function getLogs() + public function getLogs(): array|\Doctrine\Common\Collections\Collection { return $this->logs; } @@ -235,7 +210,7 @@ class CAttendance extends AbstractResource implements ResourceInterface /** * @param CAttendanceSheetLog[]|Collection $logs */ - public function setLogs(Collection $logs): self + public function setLogs(array|\Doctrine\Common\Collections\Collection $logs): self { $this->logs = $logs; @@ -245,7 +220,7 @@ class CAttendance extends AbstractResource implements ResourceInterface /** * @return CAttendanceResult[]|Collection */ - public function getResults() + public function getResults(): array|\Doctrine\Common\Collections\Collection { return $this->results; } diff --git a/src/CourseBundle/Entity/CAttendanceCalendar.php b/src/CourseBundle/Entity/CAttendanceCalendar.php index ef865cee01..e8497f583e 100644 --- a/src/CourseBundle/Entity/CAttendanceCalendar.php +++ b/src/CourseBundle/Entity/CAttendanceCalendar.php @@ -10,45 +10,30 @@ use DateTime; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_attendance_calendar", - * indexes={ - * @ORM\Index(name="done_attendance", columns={"done_attendance"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_attendance_calendar')] +#[ORM\Index(name: 'done_attendance', columns: ['done_attendance'])] +#[ORM\Entity] class CAttendanceCalendar { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendance", inversedBy="calendars", cascade={"remove"}) - * @ORM\JoinColumn(name="attendance_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CAttendance::class, inversedBy: 'calendars', cascade: ['remove'])] + #[ORM\JoinColumn(name: 'attendance_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAttendance $attendance; - /** - * @ORM\Column(name="date_time", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'date_time', type: 'datetime', nullable: false)] protected DateTime $dateTime; - /** - * @ORM\Column(name="done_attendance", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'done_attendance', type: 'boolean', nullable: false)] protected bool $doneAttendance; /** * @var Collection|CAttendanceSheet[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceSheet", mappedBy="attendanceCalendar", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CAttendanceSheet::class, mappedBy: 'attendanceCalendar', cascade: ['persist', 'remove'])] protected Collection $sheets; public function getIid(): int @@ -100,7 +85,7 @@ class CAttendanceCalendar /** * @return CAttendanceSheet[]|Collection */ - public function getSheets() + public function getSheets(): array|\Doctrine\Common\Collections\Collection { return $this->sheets; } @@ -108,7 +93,7 @@ class CAttendanceCalendar /** * @param CAttendanceSheet[]|Collection $sheets */ - public function setSheets(Collection $sheets): self + public function setSheets(array|\Doctrine\Common\Collections\Collection $sheets): self { $this->sheets = $sheets; diff --git a/src/CourseBundle/Entity/CAttendanceCalendarRelGroup.php b/src/CourseBundle/Entity/CAttendanceCalendarRelGroup.php index f45d67d392..6e8a4e926b 100644 --- a/src/CourseBundle/Entity/CAttendanceCalendarRelGroup.php +++ b/src/CourseBundle/Entity/CAttendanceCalendarRelGroup.php @@ -10,33 +10,22 @@ use Doctrine\ORM\Mapping as ORM; /** * CAttendanceCalendarRelGroup. - * - * @ORM\Table( - * name="c_attendance_calendar_rel_group", - * indexes={ - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_attendance_calendar_rel_group')] +#[ORM\Entity] class CAttendanceCalendarRelGroup { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroup") - * @ORM\JoinColumn(name="group_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CGroup::class)] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid')] protected CGroup $group; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceCalendar") - * @ORM\JoinColumn(name="calendar_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CAttendanceCalendar::class)] + #[ORM\JoinColumn(name: 'calendar_id', referencedColumnName: 'iid')] protected CAttendanceCalendar $attendanceCalendar; /** diff --git a/src/CourseBundle/Entity/CAttendanceResult.php b/src/CourseBundle/Entity/CAttendanceResult.php index 3428cbc818..e21ca0e454 100644 --- a/src/CourseBundle/Entity/CAttendanceResult.php +++ b/src/CourseBundle/Entity/CAttendanceResult.php @@ -10,39 +10,25 @@ use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_attendance_result", - * indexes={ - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_attendance_result')] +#[ORM\Entity] class CAttendanceResult { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendance", inversedBy="results") - * @ORM\JoinColumn(name="attendance_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CAttendance::class, inversedBy: 'results')] + #[ORM\JoinColumn(name: 'attendance_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAttendance $attendance; - /** - * @ORM\Column(name="score", type="integer", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'score', type: 'integer', nullable: false)] protected int $score; public function getUser(): User diff --git a/src/CourseBundle/Entity/CAttendanceSheet.php b/src/CourseBundle/Entity/CAttendanceSheet.php index 63f859e917..18b7974caa 100644 --- a/src/CourseBundle/Entity/CAttendanceSheet.php +++ b/src/CourseBundle/Entity/CAttendanceSheet.php @@ -10,40 +10,26 @@ use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_attendance_sheet", - * indexes={ - * @ORM\Index(name="presence", columns={"presence"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_attendance_sheet')] +#[ORM\Index(name: 'presence', columns: ['presence'])] +#[ORM\Entity] class CAttendanceSheet { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="presence", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'presence', type: 'boolean', nullable: false)] protected bool $presence; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceCalendar", inversedBy="sheets") - * @ORM\JoinColumn(name="attendance_calendar_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CAttendanceCalendar::class, inversedBy: 'sheets')] + #[ORM\JoinColumn(name: 'attendance_calendar_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAttendanceCalendar $attendanceCalendar; public function setPresence(bool $presence): self diff --git a/src/CourseBundle/Entity/CAttendanceSheetLog.php b/src/CourseBundle/Entity/CAttendanceSheetLog.php index e71b558336..4cf4a73662 100644 --- a/src/CourseBundle/Entity/CAttendanceSheetLog.php +++ b/src/CourseBundle/Entity/CAttendanceSheetLog.php @@ -11,50 +11,32 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_attendance_sheet_log", - * indexes={ - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_attendance_sheet_log')] +#[ORM\Entity] class CAttendanceSheetLog { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendance", inversedBy="logs") - * @ORM\JoinColumn(name="attendance_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CAttendance::class, inversedBy: 'logs')] + #[ORM\JoinColumn(name: 'attendance_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAttendance $attendance; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="lastedit_user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'lastedit_user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="lastedit_date", type="datetime", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'lastedit_date', type: 'datetime', nullable: false)] protected DateTime $lasteditDate; - /** - * @ORM\Column(name="lastedit_type", type="string", length=200, nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'lastedit_type', type: 'string', length: 200, nullable: false)] protected string $lasteditType; - /** - * @ORM\Column(name="calendar_date_value", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'calendar_date_value', type: 'datetime', nullable: true)] protected ?DateTime $calendarDateValue = null; public function setLasteditDate(DateTime $lasteditDate): self diff --git a/src/CourseBundle/Entity/CCalendarEvent.php b/src/CourseBundle/Entity/CCalendarEvent.php index 4a204dd982..38d58d1132 100644 --- a/src/CourseBundle/Entity/CCalendarEvent.php +++ b/src/CourseBundle/Entity/CCalendarEvent.php @@ -16,6 +16,7 @@ use Chamilo\CoreBundle\Controller\Api\UpdateCCalendarEventAction; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\Room; +use Chamilo\CourseBundle\Repository\CCalendarEventRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -25,13 +26,6 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Calendar events. - * - * @ORM\Table( - * name="c_calendar_event", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CCalendarEventRepository") */ #[ApiResource( collectionOperations: [ @@ -76,100 +70,76 @@ use Symfony\Component\Validator\Constraints as Assert; //#[ApiFilter(RangeFilter::class, properties: ['startDate', 'endDate'])] #[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)] +#[ORM\Table(name: 'c_calendar_event')] +#[ORM\Entity(repositoryClass: CCalendarEventRepository::class)] -class CCalendarEvent extends AbstractResource implements ResourceInterface +class CCalendarEvent extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ #[Assert\NotBlank] #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=true) - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)] protected ?DateTime $startDate = null; - /** - * @ORM\Column(name="end_date", type="datetime", nullable=true) - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)] protected ?DateTime $endDate = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEvent", inversedBy="children") - * @ORM\JoinColumn(name="parent_event_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CCalendarEvent::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_event_id', referencedColumnName: 'iid')] protected ?CCalendarEvent $parentEvent = null; /** * @var Collection|CCalendarEvent[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEvent", mappedBy="parentEvent") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CCalendarEvent::class, mappedBy: 'parentEvent')] protected Collection $children; /** * @var Collection|CCalendarEventRepeat[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEventRepeat", mappedBy="event", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CCalendarEventRepeat::class, mappedBy: 'event', cascade: ['persist'], orphanRemoval: true)] protected Collection $repeatEvents; - /** - * @ORM\Column(name="all_day", type="boolean", nullable=false) - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] #[Assert\NotNull] + #[ORM\Column(name: 'all_day', type: 'boolean', nullable: false)] protected bool $allDay; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="color", type="string", length=20, nullable=true) - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] + #[ORM\Column(name: 'color', type: 'string', length: 20, nullable: true)] protected ?string $color = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Room") - * @ORM\JoinColumn(name="room_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Room::class)] + #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')] protected ?Room $room = null; /** * @var Collection|CCalendarEventAttachment[] - * - * @ORM\OneToMany( - * targetEntity="CCalendarEventAttachment", mappedBy="event", cascade={"persist", "remove"} - * ) */ + #[ORM\OneToMany(targetEntity: 'CCalendarEventAttachment', mappedBy: 'event', cascade: ['persist', 'remove'])] protected Collection $attachments; - /** - * @ORM\Column(name="collective", type="boolean", nullable=false) - */ #[Groups(['calendar_event:read', 'calendar_event:write'])] #[Assert\NotNull] + #[ORM\Column(name: 'collective', type: 'boolean', nullable: false)] protected bool $collective = false; public function __construct() @@ -259,7 +229,7 @@ class CCalendarEvent extends AbstractResource implements ResourceInterface /** * @return Collection|CCalendarEvent[] */ - public function getChildren() + public function getChildren(): \Doctrine\Common\Collections\Collection|array { return $this->children; } @@ -276,7 +246,7 @@ class CCalendarEvent extends AbstractResource implements ResourceInterface /** * @param Collection|CCalendarEvent[] $children */ - public function setChildren(Collection $children): self + public function setChildren(\Doctrine\Common\Collections\Collection|array $children): self { $this->children = $children; @@ -370,7 +340,7 @@ class CCalendarEvent extends AbstractResource implements ResourceInterface /** * @return Collection|CCalendarEventRepeat[] */ - public function getRepeatEvents() + public function getRepeatEvents(): \Doctrine\Common\Collections\Collection|array { return $this->repeatEvents; } @@ -380,7 +350,7 @@ class CCalendarEvent extends AbstractResource implements ResourceInterface * * @return CCalendarEvent */ - public function setRepeatEvents(Collection $repeatEvents) + public function setRepeatEvents(\Doctrine\Common\Collections\Collection|array $repeatEvents) { $this->repeatEvents = $repeatEvents; diff --git a/src/CourseBundle/Entity/CCalendarEventAttachment.php b/src/CourseBundle/Entity/CCalendarEventAttachment.php index 6dff68c494..735a178800 100644 --- a/src/CourseBundle/Entity/CCalendarEventAttachment.php +++ b/src/CourseBundle/Entity/CCalendarEventAttachment.php @@ -8,41 +8,29 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository; use Doctrine\ORM\Mapping as ORM; /** * CCalendarEventAttachment. - * - * @ORM\Table( - * name="c_calendar_event_attachment", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository") */ -class CCalendarEventAttachment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_calendar_event_attachment')] +#[ORM\Entity(repositoryClass: CCalendarEventAttachmentRepository::class)] +class CCalendarEventAttachment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="filename", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)] protected string $filename; - /** - * @ORM\ManyToOne(targetEntity="CCalendarEvent", cascade={"persist"}, inversedBy="attachments") - * @ORM\JoinColumn(name="agenda_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: 'CCalendarEvent', cascade: ['persist'], inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'agenda_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CCalendarEvent $event; public function __toString(): string diff --git a/src/CourseBundle/Entity/CCalendarEventRepeat.php b/src/CourseBundle/Entity/CCalendarEventRepeat.php index 2e91958f62..5b639437b5 100644 --- a/src/CourseBundle/Entity/CCalendarEventRepeat.php +++ b/src/CourseBundle/Entity/CCalendarEventRepeat.php @@ -11,48 +11,31 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CCalendarEventRepeat. - * - * @ORM\Table( - * name="c_calendar_event_repeat", - * indexes={ - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_calendar_event_repeat')] +#[ORM\Entity] class CCalendarEventRepeat { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEvent", inversedBy="repeatEvents") - * @ORM\JoinColumn(name="cal_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CCalendarEvent::class, inversedBy: 'repeatEvents')] + #[ORM\JoinColumn(name: 'cal_id', referencedColumnName: 'iid')] protected CCalendarEvent $event; - /** - * @ORM\Column(name="cal_type", type="string", length=20, nullable=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'cal_type', type: 'string', length: 20, nullable: true)] protected ?string $calType = null; - /** - * @ORM\Column(name="cal_end", type="integer", nullable=true) - */ + #[ORM\Column(name: 'cal_end', type: 'integer', nullable: true)] protected ?int $calEnd = null; - /** - * @ORM\Column(name="cal_frequency", type="integer", nullable=true) - */ + #[ORM\Column(name: 'cal_frequency', type: 'integer', nullable: true)] protected ?int $calFrequency = null; - /** - * @ORM\Column(name="cal_days", type="string", length=7, nullable=true) - */ + #[ORM\Column(name: 'cal_days', type: 'string', length: 7, nullable: true)] protected ?string $calDays = null; public function setCalType(string $calType): self diff --git a/src/CourseBundle/Entity/CCalendarEventRepeatNot.php b/src/CourseBundle/Entity/CCalendarEventRepeatNot.php index 22472a4383..fe23e37577 100644 --- a/src/CourseBundle/Entity/CCalendarEventRepeatNot.php +++ b/src/CourseBundle/Entity/CCalendarEventRepeatNot.php @@ -10,30 +10,21 @@ use Doctrine\ORM\Mapping as ORM; /** * CCalendarEventRepeatNot. - * - * @ORM\Table( - * name="c_calendar_event_repeat_not" - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_calendar_event_repeat_not')] +#[ORM\Entity] class CCalendarEventRepeatNot { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEvent", inversedBy="repeatEvents") - * @ORM\JoinColumn(name="cal_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CCalendarEvent::class, inversedBy: 'repeatEvents')] + #[ORM\JoinColumn(name: 'cal_id', referencedColumnName: 'iid')] protected CCalendarEvent $event; - /** - * @ORM\Column(name="cal_date", type="integer") - */ + #[ORM\Column(name: 'cal_date', type: 'integer')] protected int $calDate; public function setCalDate(int $calDate): self diff --git a/src/CourseBundle/Entity/CChatConnected.php b/src/CourseBundle/Entity/CChatConnected.php index e5f4bdd827..3b051eaab3 100644 --- a/src/CourseBundle/Entity/CChatConnected.php +++ b/src/CourseBundle/Entity/CChatConnected.php @@ -11,49 +11,32 @@ use Doctrine\ORM\Mapping as ORM; /** * CChatConnected. - * - * @ORM\Table( - * name="c_chat_connected", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user", columns={"user_id"}), - * @ORM\Index(name="char_connected_index", columns={"user_id", "session_id", "to_group_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_chat_connected')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Index(name: 'char_connected_index', columns: ['user_id', 'session_id', 'to_group_id'])] +#[ORM\Entity] class CChatConnected { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="to_group_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'to_group_id', type: 'integer', nullable: false)] protected int $toGroupId; - /** - * @ORM\Column(name="user_id", type="integer") - */ + #[ORM\Column(name: 'user_id', type: 'integer')] protected int $userId; - /** - * @ORM\Column(name="last_connection", type="datetime") - */ + #[ORM\Column(name: 'last_connection', type: 'datetime')] protected DateTime $lastConnection; /** diff --git a/src/CourseBundle/Entity/CChatConversation.php b/src/CourseBundle/Entity/CChatConversation.php index 51da9781a7..78206085d2 100644 --- a/src/CourseBundle/Entity/CChatConversation.php +++ b/src/CourseBundle/Entity/CChatConversation.php @@ -12,22 +12,17 @@ use Doctrine\ORM\Mapping as ORM; /** * CChatConversation. - * - * @ORM\Table(name="c_chat_conversation") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CChatConversationRepository") */ -class CChatConversation extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_chat_conversation')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CChatConversationRepository::class)] +class CChatConversation extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: true)] protected ?string $name = null; public function __toString(): string diff --git a/src/CourseBundle/Entity/CCourseDescription.php b/src/CourseBundle/Entity/CCourseDescription.php index c0016c5c82..8df3872b57 100644 --- a/src/CourseBundle/Entity/CCourseDescription.php +++ b/src/CourseBundle/Entity/CCourseDescription.php @@ -9,14 +9,13 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; +use Chamilo\CourseBundle\Repository\CCourseDescriptionRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="c_course_description") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CCourseDescriptionRepository") - */ -class CCourseDescription extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_course_description')] +#[ORM\Entity(repositoryClass: CCourseDescriptionRepository::class)] +class CCourseDescription extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { public const TYPE_DESCRIPTION = 1; public const TYPE_OBJECTIVES = 2; @@ -27,33 +26,23 @@ class CCourseDescription extends AbstractResource implements ResourceInterface, public const TYPE_ASSESSMENT = 7; public const TYPE_CUSTOM = 8; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="text", nullable=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: true)] protected ?string $title = null; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content; - /** - * @ORM\Column(name="description_type", type="integer", nullable=false) - */ #[Assert\Choice(callback: 'getTypes')] + #[ORM\Column(name: 'description_type', type: 'integer', nullable: false)] protected int $descriptionType; - /** - * @ORM\Column(name="progress", type="integer", nullable=false) - */ + #[ORM\Column(name: 'progress', type: 'integer', nullable: false)] protected int $progress; public function __construct() diff --git a/src/CourseBundle/Entity/CCourseSetting.php b/src/CourseBundle/Entity/CCourseSetting.php index d81c0c3f45..fd870cbb76 100644 --- a/src/CourseBundle/Entity/CCourseSetting.php +++ b/src/CourseBundle/Entity/CCourseSetting.php @@ -11,70 +11,45 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course settings. - * - * @ORM\Table( - * name="c_course_setting", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_course_setting')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity] class CCourseSetting { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ #[Assert\NotBlank] + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="variable", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'variable', type: 'string', length: 255, nullable: false)] protected string $variable; - /** - * @ORM\Column(name="subkey", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'subkey', type: 'string', length: 255, nullable: true)] protected ?string $subkey = null; - /** - * @ORM\Column(name="type", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: true)] protected ?string $type = null; - /** - * @ORM\Column(name="category", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'category', type: 'string', length: 255, nullable: true)] protected ?string $category = null; - /** - * @ORM\Column(name="value", type="text", nullable=true) - */ + #[ORM\Column(name: 'value', type: 'text', nullable: true)] protected ?string $value = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected ?string $title = null; - /** - * @ORM\Column(name="comment", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'string', length: 255, nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="subkeytext", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'subkeytext', type: 'string', length: 255, nullable: true)] protected ?string $subkeytext = null; public function setVariable(string $variable): self diff --git a/src/CourseBundle/Entity/CDocument.php b/src/CourseBundle/Entity/CDocument.php index 9cb2c0bd76..c6440fc5df 100644 --- a/src/CourseBundle/Entity/CDocument.php +++ b/src/CourseBundle/Entity/CDocument.php @@ -16,8 +16,10 @@ use Chamilo\CoreBundle\Controller\Api\CreateDocumentFileAction; use Chamilo\CoreBundle\Controller\Api\UpdateDocumentFileAction; use Chamilo\CoreBundle\Controller\Api\UpdateVisibilityDocument; use Chamilo\CoreBundle\Entity\AbstractResource; +use Chamilo\CoreBundle\Entity\Listener\ResourceListener; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; +use Chamilo\CourseBundle\Repository\CDocumentRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -144,16 +146,11 @@ use Symfony\Component\Validator\Constraints as Assert; * } * }, * ) - * - * @ORM\Table( - * name="c_document", - * indexes={ - * @ORM\Index(name="idx_cdoc_type", columns={"filetype"}), - * } - * ) - * @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\ResourceListener"}) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CDocumentRepository") */ +#[ORM\Table(name: "c_document")] +#[ORM\Index(name: "idx_cdoc_type", columns: ["filetype"])] +#[ORM\Entity(repositoryClass: CDocumentRepository::class)] +#[ORM\EntityListeners([ResourceListener::class])] #[ApiFilter(PropertyFilter::class)] #[ApiFilter(SearchFilter::class, properties: [ 'title' => 'partial', @@ -168,45 +165,33 @@ use Symfony\Component\Validator\Constraints as Assert; 'resourceNode.resourceFile.size', 'resourceNode.updatedAt', ])] -class CDocument extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +class CDocument extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[ApiProperty(identifier: true)] #[Groups(['document:read'])] + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Groups(['document:read', 'document:write', 'document:browse'])] #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ #[Groups(['document:read', 'document:write'])] + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment; - /** - * @Assert\Choice({"folder", "file"}, message="Choose a valid filetype.") - * @ORM\Column(name="filetype", type="string", length=10, nullable=false) - */ #[Groups(['document:read', 'document:write'])] + #[Assert\Choice(['folder', 'file'], message: 'Choose a valid filetype.')] + #[ORM\Column(name: 'filetype', type: 'string', length: 10, nullable: false)] protected string $filetype; - /** - * @ORM\Column(name="readonly", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'readonly', type: 'boolean', nullable: false)] protected bool $readonly; - /** - * @ORM\Column(name="template", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'template', type: 'boolean', nullable: false)] protected bool $template; public function __construct() diff --git a/src/CourseBundle/Entity/CDropboxCategory.php b/src/CourseBundle/Entity/CDropboxCategory.php index d18ebc3585..1542835d31 100644 --- a/src/CourseBundle/Entity/CDropboxCategory.php +++ b/src/CourseBundle/Entity/CDropboxCategory.php @@ -11,60 +11,38 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CDropboxCategory. - * - * @ORM\Table( - * name="c_dropbox_category", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_dropbox_category')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class CDropboxCategory { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="cat_id", type="integer") - */ + #[ORM\Column(name: 'cat_id', type: 'integer')] protected int $catId; - /** - * @Assert\NotBlank() - * - * @ORM\Column(name="cat_name", type="text", nullable=false) - */ + #[Assert\NotBlank] + #[ORM\Column(name: 'cat_name', type: 'text', nullable: false)] protected string $catName; - /** - * @ORM\Column(name="received", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] protected bool $received; - /** - * @ORM\Column(name="sent", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'sent', type: 'boolean', nullable: false)] protected bool $sent; - /** - * @ORM\Column(name="user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'user_id', type: 'integer', nullable: false)] protected int $userId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; /** diff --git a/src/CourseBundle/Entity/CDropboxFeedback.php b/src/CourseBundle/Entity/CDropboxFeedback.php index 54928d9183..50438d511e 100644 --- a/src/CourseBundle/Entity/CDropboxFeedback.php +++ b/src/CourseBundle/Entity/CDropboxFeedback.php @@ -11,54 +11,35 @@ use Doctrine\ORM\Mapping as ORM; /** * CDropboxFeedback. - * - * @ORM\Table( - * name="c_dropbox_feedback", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="file_id", columns={"file_id"}), - * @ORM\Index(name="author_user_id", columns={"author_user_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_dropbox_feedback')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'file_id', columns: ['file_id'])] +#[ORM\Index(name: 'author_user_id', columns: ['author_user_id'])] +#[ORM\Entity] class CDropboxFeedback { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="feedback_id", type="integer") - */ + #[ORM\Column(name: 'feedback_id', type: 'integer')] protected int $feedbackId; - /** - * @ORM\Column(name="file_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'file_id', type: 'integer', nullable: false)] protected int $fileId; - /** - * @ORM\Column(name="author_user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'author_user_id', type: 'integer', nullable: false)] protected int $authorUserId; - /** - * @ORM\Column(name="feedback", type="text", nullable=false) - */ + #[ORM\Column(name: 'feedback', type: 'text', nullable: false)] protected string $feedback; - /** - * @ORM\Column(name="feedback_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'feedback_date', type: 'datetime', nullable: false)] protected DateTime $feedbackDate; /** diff --git a/src/CourseBundle/Entity/CDropboxFile.php b/src/CourseBundle/Entity/CDropboxFile.php index 6984210a00..18edcace02 100644 --- a/src/CourseBundle/Entity/CDropboxFile.php +++ b/src/CourseBundle/Entity/CDropboxFile.php @@ -11,82 +11,50 @@ use Doctrine\ORM\Mapping as ORM; /** * CDropboxFile. - * - * @ORM\Table( - * name="c_dropbox_file", - * options={"row_format":"DYNAMIC"}, - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="UN_filename", columns={"filename"}) - * }, - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_dropbox_file', options: ['row_format' => 'DYNAMIC'])] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\UniqueConstraint(name: 'UN_filename', columns: ['filename'])] +#[ORM\Entity] class CDropboxFile { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="uploader_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'uploader_id', type: 'integer', nullable: false)] protected int $uploaderId; - /** - * @ORM\Column(name="filename", type="string", length=190, nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 190, nullable: false)] protected string $filename; - /** - * @ORM\Column(name="filesize", type="integer", nullable=false) - */ + #[ORM\Column(name: 'filesize', type: 'integer', nullable: false)] protected int $filesize; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="string", length=250, nullable=true) - */ + #[ORM\Column(name: 'description', type: 'string', length: 250, nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="author", type="string", length=250, nullable=true) - */ + #[ORM\Column(name: 'author', type: 'string', length: 250, nullable: true)] protected ?string $author = null; - /** - * @ORM\Column(name="upload_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'upload_date', type: 'datetime', nullable: false)] protected DateTime $uploadDate; - /** - * @ORM\Column(name="last_upload_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'last_upload_date', type: 'datetime', nullable: false)] protected DateTime $lastUploadDate; - /** - * @ORM\Column(name="cat_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'cat_id', type: 'integer', nullable: false)] protected int $catId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; /** diff --git a/src/CourseBundle/Entity/CDropboxPerson.php b/src/CourseBundle/Entity/CDropboxPerson.php index d464471a07..fe0ea1450b 100644 --- a/src/CourseBundle/Entity/CDropboxPerson.php +++ b/src/CourseBundle/Entity/CDropboxPerson.php @@ -10,38 +10,25 @@ use Doctrine\ORM\Mapping as ORM; /** * CDropboxPerson. - * - * @ORM\Table( - * name="c_dropbox_person", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user", columns={"user_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_dropbox_person')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Entity] class CDropboxPerson { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="file_id", type="integer") - */ + #[ORM\Column(name: 'file_id', type: 'integer')] protected int $fileId; - /** - * @ORM\Column(name="user_id", type="integer") - */ + #[ORM\Column(name: 'user_id', type: 'integer')] protected int $userId; /** diff --git a/src/CourseBundle/Entity/CDropboxPost.php b/src/CourseBundle/Entity/CDropboxPost.php index c0536c5587..831faff4dc 100644 --- a/src/CourseBundle/Entity/CDropboxPost.php +++ b/src/CourseBundle/Entity/CDropboxPost.php @@ -11,59 +11,38 @@ use Doctrine\ORM\Mapping as ORM; /** * CDropboxPost. - * - * @ORM\Table( - * name="c_dropbox_post", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="dest_user", columns={"dest_user_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_dropbox_post')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'dest_user', columns: ['dest_user_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class CDropboxPost { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="feedback_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'feedback_date', type: 'datetime', nullable: false)] protected DateTime $feedbackDate; - /** - * @ORM\Column(name="feedback", type="text", nullable=true) - */ + #[ORM\Column(name: 'feedback', type: 'text', nullable: true)] protected ?string $feedback = null; - /** - * @ORM\Column(name="cat_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'cat_id', type: 'integer', nullable: false)] protected int $catId; - /** - * @ORM\Column(name="session_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)] protected int $sessionId; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="file_id", type="integer") - */ + #[ORM\Column(name: 'file_id', type: 'integer')] protected int $fileId; - /** - * @ORM\Column(name="dest_user_id", type="integer") - */ + #[ORM\Column(name: 'dest_user_id', type: 'integer')] protected int $destUserId; /** diff --git a/src/CourseBundle/Entity/CExerciseCategory.php b/src/CourseBundle/Entity/CExerciseCategory.php index 47409f701f..01c3120026 100644 --- a/src/CourseBundle/Entity/CExerciseCategory.php +++ b/src/CourseBundle/Entity/CExerciseCategory.php @@ -14,45 +14,31 @@ use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Timestampable\Traits\TimestampableEntity; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="c_exercise_category") - * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository") - */ -class CExerciseCategory extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_exercise_category')] +#[ORM\Entity(repositoryClass: \Gedmo\Sortable\Entity\Repository\SortableRepository::class)] +class CExerciseCategory extends AbstractResource implements ResourceInterface, \Stringable { use TimestampableEntity; - /** - * @ORM\Column(name="id", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @Gedmo\SortableGroup - * - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[Gedmo\SortableGroup] + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @Gedmo\SortablePosition - * - * @ORM\Column(name="position", type="integer") - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; public function __construct() diff --git a/src/CourseBundle/Entity/CForum.php b/src/CourseBundle/Entity/CForum.php index 2f5edbda7b..80d52573d7 100644 --- a/src/CourseBundle/Entity/CForum.php +++ b/src/CourseBundle/Entity/CForum.php @@ -17,148 +17,95 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course forums. - * - * @ORM\Table( - * name="c_forum_forum", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CForumRepository") */ -class CForum extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_forum_forum')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CForumRepository::class)] +class CForum extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="forum_title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'forum_title', type: 'string', length: 255, nullable: false)] protected string $forumTitle; - /** - * @ORM\Column(name="forum_comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'forum_comment', type: 'text', nullable: true)] protected ?string $forumComment; - /** - * @ORM\Column(name="forum_threads", type="integer", nullable=true) - */ + #[ORM\Column(name: 'forum_threads', type: 'integer', nullable: true)] protected ?int $forumThreads = null; - /** - * @ORM\Column(name="forum_posts", type="integer", nullable=true) - */ + #[ORM\Column(name: 'forum_posts', type: 'integer', nullable: true)] protected ?int $forumPosts; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost") - * @ORM\JoinColumn(name="forum_last_post", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CForumPost::class)] + #[ORM\JoinColumn(name: 'forum_last_post', referencedColumnName: 'iid')] protected ?CForumPost $forumLastPost = null; - /** - * @Gedmo\SortableGroup - * - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumCategory", inversedBy="forums") - * @ORM\JoinColumn(name="forum_category", referencedColumnName="iid", nullable=true, onDelete="SET NULL") - */ + #[Gedmo\SortableGroup] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CForumCategory::class, inversedBy: 'forums')] + #[ORM\JoinColumn(name: 'forum_category', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')] protected ?CForumCategory $forumCategory = null; - /** - * @ORM\Column(name="allow_anonymous", type="integer", nullable=true) - */ + #[ORM\Column(name: 'allow_anonymous', type: 'integer', nullable: true)] protected ?int $allowAnonymous = null; - /** - * @ORM\Column(name="allow_edit", type="integer", nullable=true) - */ + #[ORM\Column(name: 'allow_edit', type: 'integer', nullable: true)] protected ?int $allowEdit = null; - /** - * @ORM\Column(name="approval_direct_post", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'approval_direct_post', type: 'string', length: 20, nullable: true)] protected ?string $approvalDirectPost = null; - /** - * @ORM\Column(name="allow_attachments", type="integer", nullable=true) - */ + #[ORM\Column(name: 'allow_attachments', type: 'integer', nullable: true)] protected ?int $allowAttachments = null; - /** - * @ORM\Column(name="allow_new_threads", type="integer", nullable=true) - */ + #[ORM\Column(name: 'allow_new_threads', type: 'integer', nullable: true)] protected ?int $allowNewThreads = null; - /** - * @ORM\Column(name="default_view", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'default_view', type: 'string', length: 20, nullable: true)] protected ?string $defaultView = null; - /** - * @ORM\Column(name="forum_of_group", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'forum_of_group', type: 'string', length: 20, nullable: true)] protected ?string $forumOfGroup; - /** - * @ORM\Column(name="forum_group_public_private", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'forum_group_public_private', type: 'string', length: 20, nullable: true)] protected ?string $forumGroupPublicPrivate; - /** - * @Gedmo\SortablePosition - * - * @ORM\Column(name="forum_order", type="integer", nullable=true) - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'forum_order', type: 'integer', nullable: true)] protected ?int $forumOrder = null; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; - /** - * @ORM\Column(name="forum_image", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'forum_image', type: 'string', length: 255, nullable: false)] protected string $forumImage; - /** - * @ORM\Column(name="start_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'start_time', type: 'datetime', nullable: true)] protected ?DateTime $startTime = null; - /** - * @ORM\Column(name="end_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'end_time', type: 'datetime', nullable: true)] protected ?DateTime $endTime = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp", inversedBy="forums", cascade={"remove"}) - * @ORM\JoinColumn(name="lp_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLp::class, inversedBy: 'forums', cascade: ['remove'])] + #[ORM\JoinColumn(name: 'lp_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')] protected ?CLp $lp = null; - /** - * @ORM\Column(name="moderated", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'moderated', type: 'boolean', nullable: true)] protected ?bool $moderated = null; /** * @var Collection|CForumThread[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumThread", mappedBy="forum", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CForumThread::class, mappedBy: 'forum', cascade: ['persist'], orphanRemoval: true)] protected Collection $threads; /** * @var Collection|CForumPost[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", mappedBy="forum", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CForumPost::class, mappedBy: 'forum', cascade: ['persist'], orphanRemoval: true)] protected Collection $posts; public function __construct() @@ -248,10 +195,8 @@ class CForum extends AbstractResource implements ResourceInterface /** * Get forumCategory. - * - * @return null|CForumCategory */ - public function getForumCategory() + public function getForumCategory(): ?\Chamilo\CourseBundle\Entity\CForumCategory { return $this->forumCategory; } @@ -502,7 +447,7 @@ class CForum extends AbstractResource implements ResourceInterface * * @return Collection|CForumThread[] */ - public function getThreads() + public function getThreads(): \Doctrine\Common\Collections\Collection|array { return $this->threads; } @@ -534,7 +479,7 @@ class CForum extends AbstractResource implements ResourceInterface /** * @return Collection|CForumPost[] */ - public function getPosts() + public function getPosts(): \Doctrine\Common\Collections\Collection|array { return $this->posts; } diff --git a/src/CourseBundle/Entity/CForumAttachment.php b/src/CourseBundle/Entity/CForumAttachment.php index f660406886..1cf97e27a0 100644 --- a/src/CourseBundle/Entity/CForumAttachment.php +++ b/src/CourseBundle/Entity/CForumAttachment.php @@ -8,55 +8,36 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_forum_attachment", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CForumAttachmentRepository") - */ -class CForumAttachment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_forum_attachment')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity(repositoryClass: CForumAttachmentRepository::class)] +class CForumAttachment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="path", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)] protected string $path; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="size", type="integer", nullable=false) - */ + #[ORM\Column(name: 'size', type: 'integer', nullable: false)] protected int $size; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", cascade={"persist"}, inversedBy="attachments") - * @ORM\JoinColumn(name="post_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CForumPost::class, cascade: ['persist'], inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'post_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CForumPost $post; - /** - * @ORM\Column(name="filename", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)] protected string $filename; public function __construct() diff --git a/src/CourseBundle/Entity/CForumCategory.php b/src/CourseBundle/Entity/CForumCategory.php index 9e09849c08..55b80657f8 100644 --- a/src/CourseBundle/Entity/CForumCategory.php +++ b/src/CourseBundle/Entity/CForumCategory.php @@ -8,54 +8,38 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CForumCategoryRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_forum_category", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CForumCategoryRepository") - */ -class CForumCategory extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_forum_category')] +#[ORM\Entity(repositoryClass: CForumCategoryRepository::class)] +class CForumCategory extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="cat_title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'cat_title', type: 'string', length: 255, nullable: false)] protected string $catTitle; - /** - * @ORM\Column(name="cat_comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'cat_comment', type: 'text', nullable: true)] protected ?string $catComment; - /** - * @ORM\Column(name="cat_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'cat_order', type: 'integer', nullable: false)] protected int $catOrder; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; /** * @var Collection|CForum[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForum", mappedBy="forumCategory") */ + #[ORM\OneToMany(targetEntity: CForum::class, mappedBy: 'forumCategory')] protected Collection $forums; public function __construct() @@ -149,7 +133,7 @@ class CForumCategory extends AbstractResource implements ResourceInterface * * @return Collection|CForum[] */ - public function getForums() + public function getForums(): \Doctrine\Common\Collections\Collection|array { return $this->forums; } diff --git a/src/CourseBundle/Entity/CForumMailcue.php b/src/CourseBundle/Entity/CForumMailcue.php index a30ddadde2..4f66b3f5cd 100644 --- a/src/CourseBundle/Entity/CForumMailcue.php +++ b/src/CourseBundle/Entity/CForumMailcue.php @@ -8,45 +8,29 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_forum_mailcue", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="thread", columns={"thread_id"}), - * @ORM\Index(name="user", columns={"user_id"}), - * @ORM\Index(name="post", columns={"post_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_forum_mailcue')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'thread', columns: ['thread_id'])] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Index(name: 'post', columns: ['post_id'])] +#[ORM\Entity] class CForumMailcue { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="thread_id", type="integer") - */ + #[ORM\Column(name: 'thread_id', type: 'integer')] protected int $threadId; - /** - * @ORM\Column(name="user_id", type="integer") - */ + #[ORM\Column(name: 'user_id', type: 'integer')] protected int $userId; - /** - * @ORM\Column(name="post_id", type="integer") - */ + #[ORM\Column(name: 'post_id', type: 'integer')] protected int $postId; /** diff --git a/src/CourseBundle/Entity/CForumNotification.php b/src/CourseBundle/Entity/CForumNotification.php index 624d551207..0579deff03 100644 --- a/src/CourseBundle/Entity/CForumNotification.php +++ b/src/CourseBundle/Entity/CForumNotification.php @@ -10,51 +10,34 @@ use Doctrine\ORM\Mapping as ORM; /** * CForumNotification. - * - * @ORM\Table( - * name="c_forum_notification", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="thread", columns={"thread_id"}), - * @ORM\Index(name="post", columns={"post_id"}), - * @ORM\Index(name="user_id", columns={"user_id"}), - * @ORM\Index(name="forum_id", columns={"forum_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_forum_notification')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'thread', columns: ['thread_id'])] +#[ORM\Index(name: 'post', columns: ['post_id'])] +#[ORM\Index(name: 'user_id', columns: ['user_id'])] +#[ORM\Index(name: 'forum_id', columns: ['forum_id'])] +#[ORM\Entity] class CForumNotification { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="user_id", type="integer") - */ + #[ORM\Column(name: 'user_id', type: 'integer')] protected int $userId; - /** - * @ORM\Column(name="forum_id", type="integer") - */ + #[ORM\Column(name: 'forum_id', type: 'integer')] protected int $forumId; - /** - * @ORM\Column(name="thread_id", type="integer") - */ + #[ORM\Column(name: 'thread_id', type: 'integer')] protected int $threadId; - /** - * @ORM\Column(name="post_id", type="integer") - */ + #[ORM\Column(name: 'post_id', type: 'integer')] protected int $postId; public function __construct() diff --git a/src/CourseBundle/Entity/CForumPost.php b/src/CourseBundle/Entity/CForumPost.php index e2948727c0..ae1a677879 100644 --- a/src/CourseBundle/Entity/CForumPost.php +++ b/src/CourseBundle/Entity/CForumPost.php @@ -9,6 +9,7 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\User; +use Chamilo\CourseBundle\Repository\CForumPostRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -17,99 +18,71 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CForumPost. - * - * @ORM\Table( - * name="c_forum_post", - * indexes={ - * @ORM\Index(name="forum_id", columns={"forum_id"}), - * @ORM\Index(name="idx_forum_post_thread_id", columns={"thread_id"}), - * @ORM\Index(name="idx_forum_post_visible", columns={"visible"}), - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CForumPostRepository") */ -class CForumPost extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_forum_post')] +#[ORM\Index(name: 'forum_id', columns: ['forum_id'])] +#[ORM\Index(name: 'idx_forum_post_thread_id', columns: ['thread_id'])] +#[ORM\Index(name: 'idx_forum_post_visible', columns: ['visible'])] +#[ORM\Entity(repositoryClass: CForumPostRepository::class)] +class CForumPost extends AbstractResource implements ResourceInterface, \Stringable { public const STATUS_VALIDATED = 1; public const STATUS_WAITING_MODERATION = 2; public const STATUS_REJECTED = 3; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="post_title", type="string", length=250, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'post_title', type: 'string', length: 250, nullable: false)] protected string $postTitle; - /** - * @ORM\Column(name="post_text", type="text", nullable=true) - */ + #[ORM\Column(name: 'post_text', type: 'text', nullable: true)] protected ?string $postText = null; - /** - * @ORM\Column(name="post_date", type="datetime", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'post_date', type: 'datetime', nullable: false)] protected DateTime $postDate; - /** - * @ORM\Column(name="post_notification", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'post_notification', type: 'boolean', nullable: true)] protected ?bool $postNotification = null; - /** - * @ORM\Column(name="visible", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'visible', type: 'boolean', nullable: false)] protected bool $visible; - /** - * @ORM\Column(name="status", type="integer", nullable=true) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: true)] protected ?int $status = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumThread", inversedBy="posts") - * @ORM\JoinColumn(name="thread_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CForumThread::class, inversedBy: 'posts')] + #[ORM\JoinColumn(name: 'thread_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')] protected ?CForumThread $thread = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForum", inversedBy="posts") - * @ORM\JoinColumn(name="forum_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CForum::class, inversedBy: 'posts')] + #[ORM\JoinColumn(name: 'forum_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')] protected ?CForum $forum = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="poster_id", referencedColumnName="id") - */ #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'poster_id', referencedColumnName: 'id')] protected ?User $user = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", inversedBy="children") - * @ORM\JoinColumn(name="post_parent_id", referencedColumnName="iid", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CForumPost::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'post_parent_id', referencedColumnName: 'iid', onDelete: 'SET NULL')] protected ?CForumPost $postParent = null; /** * @var Collection|CForumPost[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", mappedBy="postParent") */ + #[ORM\OneToMany(targetEntity: CForumPost::class, mappedBy: 'postParent')] protected Collection $children; /** * @var Collection|CForumAttachment[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumAttachment", mappedBy="post", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: CForumAttachment::class, mappedBy: 'post', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $attachments; public function __construct() @@ -291,7 +264,7 @@ class CForumPost extends AbstractResource implements ResourceInterface /** * @return CForumPost[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } @@ -299,7 +272,7 @@ class CForumPost extends AbstractResource implements ResourceInterface /** * @param CForumPost[]|Collection $children */ - public function setChildren(Collection $children): self + public function setChildren(array|\Doctrine\Common\Collections\Collection $children): self { $this->children = $children; diff --git a/src/CourseBundle/Entity/CForumThread.php b/src/CourseBundle/Entity/CForumThread.php index ad8ea800bd..27422ef4d9 100644 --- a/src/CourseBundle/Entity/CForumThread.php +++ b/src/CourseBundle/Entity/CForumThread.php @@ -9,6 +9,7 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\User; +use Chamilo\CourseBundle\Repository\CForumThreadRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -17,120 +18,81 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CForumThread. - * - * @ORM\Table( - * name="c_forum_thread", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CForumThreadRepository") */ -class CForumThread extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_forum_thread')] +#[ORM\Entity(repositoryClass: CForumThreadRepository::class)] +class CForumThread extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="thread_title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'thread_title', type: 'string', length: 255, nullable: false)] protected string $threadTitle; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForum", inversedBy="threads") - * @ORM\JoinColumn(name="forum_id", referencedColumnName="iid", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CForum::class, inversedBy: 'threads')] + #[ORM\JoinColumn(name: 'forum_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')] protected ?CForum $forum = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="thread_poster_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'thread_poster_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", cascade={"persist", "remove"}) - * @ORM\JoinColumn(name="thread_last_post", referencedColumnName="iid", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CForumPost::class, cascade: ['persist', 'remove'])] + #[ORM\JoinColumn(name: 'thread_last_post', referencedColumnName: 'iid', onDelete: 'SET NULL')] protected ?CForumPost $threadLastPost = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem") - * @ORM\JoinColumn(name="lp_item_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CLpItem::class)] + #[ORM\JoinColumn(name: 'lp_item_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected ?CLpItem $item = null; /** * @var Collection|CForumPost[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", mappedBy="thread", cascade={"persist", "remove"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: CForumPost::class, mappedBy: 'thread', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $posts; /** * @var Collection|CForumThreadQualify[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumThreadQualify", mappedBy="thread", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: CForumThreadQualify::class, mappedBy: 'thread', cascade: ['persist', 'remove'])] protected Collection $qualifications; - /** - * @ORM\Column(name="thread_date", type="datetime", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'thread_date', type: 'datetime', nullable: false)] protected DateTime $threadDate; - /** - * @ORM\Column(name="thread_replies", type="integer", nullable=false, options={"unsigned":true, "default":0}) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'thread_replies', type: 'integer', nullable: false, options: ['unsigned' => true, 'default' => 0])] protected int $threadReplies; - /** - * @ORM\Column(name="thread_views", type="integer", nullable=false, options={"unsigned":true, "default":0}) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'thread_views', type: 'integer', nullable: false, options: ['unsigned' => true, 'default' => 0])] protected int $threadViews; - /** - * @ORM\Column(name="thread_sticky", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'thread_sticky', type: 'boolean', nullable: false)] protected bool $threadSticky; - /** - * @ORM\Column(name="locked", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'locked', type: 'integer', nullable: false)] protected int $locked; - /** - * @ORM\Column(name="thread_title_qualify", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'thread_title_qualify', type: 'string', length: 255, nullable: true)] protected ?string $threadTitleQualify = null; - /** - * @ORM\Column(name="thread_qualify_max", type="float", precision=6, scale=2, nullable=false) - */ + #[ORM\Column(name: 'thread_qualify_max', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $threadQualifyMax; - /** - * @ORM\Column(name="thread_close_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'thread_close_date', type: 'datetime', nullable: true)] protected ?DateTime $threadCloseDate = null; - /** - * @ORM\Column(name="thread_weight", type="float", precision=6, scale=2, nullable=false) - */ + #[ORM\Column(name: 'thread_weight', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $threadWeight; - /** - * @ORM\Column(name="thread_peer_qualify", type="boolean") - */ + #[ORM\Column(name: 'thread_peer_qualify', type: 'boolean')] protected bool $threadPeerQualify; public function __construct() @@ -359,7 +321,7 @@ class CForumThread extends AbstractResource implements ResourceInterface /** * @return Collection|CForumPost[] */ - public function getPosts() + public function getPosts(): \Doctrine\Common\Collections\Collection|array { return $this->posts; } @@ -379,7 +341,7 @@ class CForumThread extends AbstractResource implements ResourceInterface /** * @return CForumThreadQualify[]|Collection */ - public function getQualifications() + public function getQualifications(): array|\Doctrine\Common\Collections\Collection { return $this->qualifications; } @@ -387,7 +349,7 @@ class CForumThread extends AbstractResource implements ResourceInterface /** * @param CForumThreadQualify[]|Collection $qualifications */ - public function setQualifications(Collection $qualifications): self + public function setQualifications(array|\Doctrine\Common\Collections\Collection $qualifications): self { $this->qualifications = $qualifications; diff --git a/src/CourseBundle/Entity/CForumThreadQualify.php b/src/CourseBundle/Entity/CForumThreadQualify.php index e2eab5f8ec..ae6c0db33b 100644 --- a/src/CourseBundle/Entity/CForumThreadQualify.php +++ b/src/CourseBundle/Entity/CForumThreadQualify.php @@ -10,56 +10,36 @@ use Chamilo\CoreBundle\Entity\User; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_forum_thread_qualify", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user_id", columns={"user_id", "thread_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_forum_thread_qualify')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user_id', columns: ['user_id', 'thread_id'])] +#[ORM\Entity] class CForumThreadQualify { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumThread", inversedBy="qualifications") - * @ORM\JoinColumn(name="thread_id", referencedColumnName="iid", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CForumThread::class, inversedBy: 'qualifications')] + #[ORM\JoinColumn(name: 'thread_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')] protected CForumThread $thread; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="qualify_user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'qualify_user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $qualifyUser; - /** - * @ORM\Column(name="qualify", type="float", precision=6, scale=2, nullable=false) - */ + #[ORM\Column(name: 'qualify', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $qualify; - /** - * @ORM\Column(name="qualify_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'qualify_time', type: 'datetime', nullable: true)] protected ?DateTime $qualifyTime = null; public function setQualify(float $qualify): self diff --git a/src/CourseBundle/Entity/CForumThreadQualifyLog.php b/src/CourseBundle/Entity/CForumThreadQualifyLog.php index 3f6a5685f8..753a995512 100644 --- a/src/CourseBundle/Entity/CForumThreadQualifyLog.php +++ b/src/CourseBundle/Entity/CForumThreadQualifyLog.php @@ -11,58 +11,37 @@ use Doctrine\ORM\Mapping as ORM; /** * CForumThreadQualifyLog. - * - * @ORM\Table( - * name="c_forum_thread_qualify_log", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user_id", columns={"user_id", "thread_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_forum_thread_qualify_log')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user_id', columns: ['user_id', 'thread_id'])] +#[ORM\Entity] class CForumThreadQualifyLog { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'user_id', type: 'integer', nullable: false)] protected int $userId; - /** - * @ORM\Column(name="thread_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'thread_id', type: 'integer', nullable: false)] protected int $threadId; - /** - * @ORM\Column(name="qualify", type="float", precision=6, scale=2, nullable=false) - */ + #[ORM\Column(name: 'qualify', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $qualify; - /** - * @ORM\Column(name="qualify_user_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'qualify_user_id', type: 'integer', nullable: true)] protected ?int $qualifyUserId = null; - /** - * @ORM\Column(name="qualify_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'qualify_time', type: 'datetime', nullable: true)] protected ?DateTime $qualifyTime = null; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; /** diff --git a/src/CourseBundle/Entity/CGlossary.php b/src/CourseBundle/Entity/CGlossary.php index 5f439233eb..88d0a79b04 100644 --- a/src/CourseBundle/Entity/CGlossary.php +++ b/src/CourseBundle/Entity/CGlossary.php @@ -13,35 +13,24 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course glossary. - * - * @ORM\Table( - * name="c_glossary" - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CGlossaryRepository") */ -class CGlossary extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_glossary')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CGlossaryRepository::class)] +class CGlossary extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected ?string $description = null; - /** - * @ORM\Column(name="display_order", type="integer", nullable=true) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: true)] protected ?int $displayOrder = null; public function __toString(): string diff --git a/src/CourseBundle/Entity/CGroup.php b/src/CourseBundle/Entity/CGroup.php index 1d4b3be2f9..d45908750d 100644 --- a/src/CourseBundle/Entity/CGroup.php +++ b/src/CourseBundle/Entity/CGroup.php @@ -10,6 +10,7 @@ use ApiPlatform\Core\Annotation\ApiResource; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\User; +use Chamilo\CourseBundle\Repository\CGroupRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -19,13 +20,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course groups. * - * @ORM\Table( - * name="c_group_info", - * indexes={ - * } - * ) * - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CGroupRepository") */ #[ApiResource( attributes: [ @@ -35,113 +30,81 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['group:read'], ], )] -class CGroup extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_group_info')] +#[ORM\Entity(repositoryClass: CGroupRepository::class)] +class CGroup extends AbstractResource implements ResourceInterface, \Stringable { public const TOOL_NOT_AVAILABLE = 0; public const TOOL_PUBLIC = 1; public const TOOL_PRIVATE = 2; public const TOOL_PRIVATE_BETWEEN_USERS = 3; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - * @Groups({"group:read", "group:write"}) - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] + #[Groups(['group:read', 'group:write'])] protected int $iid; - /** - * @ORM\Column(name="name", type="string", length=100, nullable=false) - * @Groups({"group:read", "group:write"}) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 100, nullable: false)] + #[Groups(['group:read', 'group:write'])] protected string $name; - /** - * @ORM\Column(name="status", type="boolean", nullable=false) - */ #[Assert\NotNull] + #[ORM\Column(name: 'status', type: 'boolean', nullable: false)] protected bool $status; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupCategory", cascade={"persist"}) - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CGroupCategory::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected ?CGroupCategory $category = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="max_student", type="integer") - */ #[Assert\NotBlank] + #[ORM\Column(name: 'max_student', type: 'integer')] protected int $maxStudent; - /** - * @ORM\Column(name="doc_state", type="integer") - */ + #[ORM\Column(name: 'doc_state', type: 'integer')] protected int $docState; - /** - * @ORM\Column(name="calendar_state", type="integer") - */ + #[ORM\Column(name: 'calendar_state', type: 'integer')] protected int $calendarState; - /** - * @ORM\Column(name="work_state", type="integer") - */ + #[ORM\Column(name: 'work_state', type: 'integer')] protected int $workState; - /** - * @ORM\Column(name="announcements_state", type="integer") - */ + #[ORM\Column(name: 'announcements_state', type: 'integer')] protected int $announcementsState; - /** - * @ORM\Column(name="forum_state", type="integer") - */ + #[ORM\Column(name: 'forum_state', type: 'integer')] protected int $forumState; - /** - * @ORM\Column(name="wiki_state", type="integer") - */ + #[ORM\Column(name: 'wiki_state', type: 'integer')] protected int $wikiState; - /** - * @ORM\Column(name="chat_state", type="integer") - */ + #[ORM\Column(name: 'chat_state', type: 'integer')] protected int $chatState; - /** - * @ORM\Column(name="self_registration_allowed", type="boolean") - */ + #[ORM\Column(name: 'self_registration_allowed', type: 'boolean')] protected bool $selfRegistrationAllowed; - /** - * @ORM\Column(name="self_unregistration_allowed", type="boolean") - */ + #[ORM\Column(name: 'self_unregistration_allowed', type: 'boolean')] protected bool $selfUnregistrationAllowed; - /** - * @ORM\Column(name="document_access", type="integer", options={"default":0}) - */ + #[ORM\Column(name: 'document_access', type: 'integer', options: ['default' => 0])] protected int $documentAccess; /** * @var CGroupRelUser[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="group") */ + #[ORM\OneToMany(targetEntity: CGroupRelUser::class, mappedBy: 'group')] protected Collection $members; /** * @var CGroupRelTutor[]|Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="group") */ + #[ORM\OneToMany(targetEntity: CGroupRelTutor::class, mappedBy: 'group')] protected Collection $tutors; public function __construct() @@ -392,7 +355,7 @@ class CGroup extends AbstractResource implements ResourceInterface /** * @return CGroupRelUser[]|Collection */ - public function getMembers() + public function getMembers(): array|\Doctrine\Common\Collections\Collection { return $this->members; } @@ -400,7 +363,7 @@ class CGroup extends AbstractResource implements ResourceInterface /** * @param CGroupRelUser[]|Collection $members */ - public function setMembers(Collection $members): self + public function setMembers(array|\Doctrine\Common\Collections\Collection $members): self { $this->members = $members; @@ -418,9 +381,7 @@ class CGroup extends AbstractResource implements ResourceInterface return false; } - $list = $this->members->filter(function (CGroupRelUser $member) use ($user) { - return $member->getUser()->getId() === $user->getId(); - }); + $list = $this->members->filter(fn (CGroupRelUser $member) => $member->getUser()->getId() === $user->getId()); return $list->count() > 0; } @@ -431,9 +392,7 @@ class CGroup extends AbstractResource implements ResourceInterface return false; } - $list = $this->tutors->filter(function (CGroupRelTutor $tutor) use ($user) { - return $tutor->getUser()->getId() === $user->getId(); - }); + $list = $this->tutors->filter(fn (CGroupRelTutor $tutor) => $tutor->getUser()->getId() === $user->getId()); return $list->count() > 0; } @@ -441,7 +400,7 @@ class CGroup extends AbstractResource implements ResourceInterface /** * @return CGroupRelTutor[]|Collection */ - public function getTutors() + public function getTutors(): array|\Doctrine\Common\Collections\Collection { return $this->tutors; } @@ -449,7 +408,7 @@ class CGroup extends AbstractResource implements ResourceInterface /** * @param CGroupRelTutor[]|Collection $tutors */ - public function setTutors(Collection $tutors): self + public function setTutors(array|\Doctrine\Common\Collections\Collection $tutors): self { $this->tutors = $tutors; diff --git a/src/CourseBundle/Entity/CGroupCategory.php b/src/CourseBundle/Entity/CGroupCategory.php index 5349c84598..dceed340dc 100644 --- a/src/CourseBundle/Entity/CGroupCategory.php +++ b/src/CourseBundle/Entity/CGroupCategory.php @@ -8,97 +8,63 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CGroupCategoryRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * Group categories inside a course. - * - * @ORM\Table( - * name="c_group_category", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CGroupCategoryRepository") */ -class CGroupCategory extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_group_category')] +#[ORM\Entity(repositoryClass: CGroupCategoryRepository::class)] +class CGroupCategory extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected ?string $description; - /** - * @ORM\Column(name="doc_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'doc_state', type: 'boolean', nullable: false)] protected bool $docState; - /** - * @ORM\Column(name="calendar_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'calendar_state', type: 'boolean', nullable: false)] protected bool $calendarState; - /** - * @ORM\Column(name="work_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'work_state', type: 'boolean', nullable: false)] protected bool $workState; - /** - * @ORM\Column(name="announcements_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'announcements_state', type: 'boolean', nullable: false)] protected bool $announcementsState; - /** - * @ORM\Column(name="forum_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'forum_state', type: 'boolean', nullable: false)] protected bool $forumState; - /** - * @ORM\Column(name="wiki_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'wiki_state', type: 'boolean', nullable: false)] protected bool $wikiState; - /** - * @ORM\Column(name="chat_state", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'chat_state', type: 'boolean', nullable: false)] protected bool $chatState; - /** - * @ORM\Column(name="max_student", type="integer", nullable=false) - */ + #[ORM\Column(name: 'max_student', type: 'integer', nullable: false)] protected int $maxStudent; - /** - * @ORM\Column(name="self_reg_allowed", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'self_reg_allowed', type: 'boolean', nullable: false)] protected bool $selfRegAllowed; - /** - * @ORM\Column(name="self_unreg_allowed", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'self_unreg_allowed', type: 'boolean', nullable: false)] protected bool $selfUnregAllowed; - /** - * @ORM\Column(name="groups_per_user", type="integer", nullable=false) - */ + #[ORM\Column(name: 'groups_per_user', type: 'integer', nullable: false)] protected int $groupsPerUser; - /** - * @ORM\Column(name="document_access", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: 'document_access', type: 'integer', nullable: false, options: ['default' => 0])] protected int $documentAccess; public function __construct() diff --git a/src/CourseBundle/Entity/CGroupRelTutor.php b/src/CourseBundle/Entity/CGroupRelTutor.php index ff9d574335..5bd16106e6 100644 --- a/src/CourseBundle/Entity/CGroupRelTutor.php +++ b/src/CourseBundle/Entity/CGroupRelTutor.php @@ -9,39 +9,25 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_group_rel_tutor", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_group_rel_tutor')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity] class CGroupRelTutor { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="courseGroupsAsTutor") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'courseGroupsAsTutor')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroup", inversedBy="tutors") - * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CGroup::class, inversedBy: 'tutors')] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', nullable: false, onDelete: 'CASCADE')] protected CGroup $group; public function setUser(User $user): self diff --git a/src/CourseBundle/Entity/CGroupRelUser.php b/src/CourseBundle/Entity/CGroupRelUser.php index c42872c7e8..dd0e448682 100644 --- a/src/CourseBundle/Entity/CGroupRelUser.php +++ b/src/CourseBundle/Entity/CGroupRelUser.php @@ -12,51 +12,34 @@ use Doctrine\ORM\Mapping as ORM; /** * CGroupRelUser. - * - * @ORM\Table( - * name="c_group_rel_user", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_group_rel_user')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity] class CGroupRelUser { use UserTrait; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="courseGroupsAsMember") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'courseGroupsAsMember')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroup", inversedBy="members") - * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CGroup::class, inversedBy: 'members')] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', nullable: false, onDelete: 'CASCADE')] protected CGroup $group; - /** - * @ORM\Column(name="status", type="integer", nullable=false) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: false)] protected int $status; - /** - * @ORM\Column(name="role", type="string", length=50, nullable=false) - */ + #[ORM\Column(name: 'role', type: 'string', length: 50, nullable: false)] protected string $role; public function setGroup(CGroup $group): self diff --git a/src/CourseBundle/Entity/CLink.php b/src/CourseBundle/Entity/CLink.php index ea065c6193..a2754bc6ed 100644 --- a/src/CourseBundle/Entity/CLink.php +++ b/src/CourseBundle/Entity/CLink.php @@ -8,53 +8,38 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CLinkRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="c_link") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CLinkRepository") - */ -class CLink extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_link')] +#[ORM\Entity(repositoryClass: CLinkRepository::class)] +class CLink extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $iid = null; - /** - * @ORM\Column(name="url", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'url', type: 'text', nullable: false)] protected string $url; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLinkCategory", inversedBy="links") - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CLinkCategory::class, inversedBy: 'links')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid', onDelete: 'SET NULL')] protected ?CLinkCategory $category = null; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false)] protected int $displayOrder; - /** - * @ORM\Column(name="target", type="string", length=10, nullable=true) - */ + #[ORM\Column(name: 'target', type: 'string', length: 10, nullable: true)] protected ?string $target = null; public function __construct() diff --git a/src/CourseBundle/Entity/CLinkCategory.php b/src/CourseBundle/Entity/CLinkCategory.php index 6feb602712..d69f8ef469 100644 --- a/src/CourseBundle/Entity/CLinkCategory.php +++ b/src/CourseBundle/Entity/CLinkCategory.php @@ -15,44 +15,30 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CLinkCategory. - * - * @ORM\Table( - * name="c_link_category", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CLinkCategoryRepository") */ -class CLinkCategory extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_link_category')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CLinkCategoryRepository::class)] +class CLinkCategory extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="category_title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'category_title', type: 'string', length: 255, nullable: false)] protected string $categoryTitle; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false)] protected int $displayOrder; /** * @var Collection|CLink[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLink", mappedBy="category") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CLink::class, mappedBy: 'category')] protected Collection $links; public function __construct() @@ -111,7 +97,7 @@ class CLinkCategory extends AbstractResource implements ResourceInterface /** * @return CLink[]|Collection */ - public function getLinks() + public function getLinks(): array|\Doctrine\Common\Collections\Collection { return $this->links; } diff --git a/src/CourseBundle/Entity/CLp.php b/src/CourseBundle/Entity/CLp.php index 1618537b6b..222ce83e62 100644 --- a/src/CourseBundle/Entity/CLp.php +++ b/src/CourseBundle/Entity/CLp.php @@ -10,6 +10,7 @@ use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\Asset; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; +use Chamilo\CourseBundle\Repository\CLpRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -19,205 +20,131 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course learning paths (LPs). - * - * @ORM\Table( - * name="c_lp" - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CLpRepository") */ -class CLp extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_lp')] +#[ORM\Entity(repositoryClass: CLpRepository::class)] +class CLp extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { public const LP_TYPE = 1; public const SCORM_TYPE = 2; public const AICC_TYPE = 3; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="lp_type", type="integer", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'lp_type', type: 'integer', nullable: false)] protected int $lpType; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="ref", type="text", nullable=true) - */ + #[ORM\Column(name: 'ref', type: 'text', nullable: true)] protected ?string $ref = null; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="path", type="text", nullable=false) - */ + #[ORM\Column(name: 'path', type: 'text', nullable: false)] protected string $path; - /** - * @ORM\Column(name="force_commit", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'force_commit', type: 'boolean', nullable: false)] protected bool $forceCommit; - /** - * @ORM\Column(name="default_view_mod", type="string", length=32, nullable=false, options={"default":"embedded"}) - */ + #[ORM\Column(name: 'default_view_mod', type: 'string', length: 32, nullable: false, options: ['default' => 'embedded'])] protected string $defaultViewMod; - /** - * @ORM\Column(name="default_encoding", type="string", length=32, nullable=false, options={"default":"UTF-8"}) - */ + #[ORM\Column(name: 'default_encoding', type: 'string', length: 32, nullable: false, options: ['default' => 'UTF-8'])] protected string $defaultEncoding; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false, options={"default":"0"}) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false, options: ['default' => 0])] protected int $displayOrder; - /** - * @ORM\Column(name="content_maker", type="text", nullable=false) - */ + #[ORM\Column(name: 'content_maker', type: 'text', nullable: false)] protected string $contentMaker; - /** - * @ORM\Column(name="content_local", type="string", length=32, nullable=false, options={"default":"local"}) - */ + #[ORM\Column(name: 'content_local', type: 'string', length: 32, nullable: false, options: ['default' => 'local'])] protected string $contentLocal; - /** - * @ORM\Column(name="content_license", type="text", nullable=false) - */ + #[ORM\Column(name: 'content_license', type: 'text', nullable: false)] protected string $contentLicense; - /** - * @ORM\Column(name="prevent_reinit", type="boolean", nullable=false, options={"default":"1"}) - */ + #[ORM\Column(name: 'prevent_reinit', type: 'boolean', nullable: false, options: ['default' => 1])] protected bool $preventReinit; - /** - * @ORM\Column(name="js_lib", type="text", nullable=false) - */ + #[ORM\Column(name: 'js_lib', type: 'text', nullable: false)] protected string $jsLib; - /** - * @ORM\Column(name="debug", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'debug', type: 'boolean', nullable: false)] protected bool $debug; - /** - * @ORM\Column(name="theme", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'theme', type: 'string', length: 255, nullable: false)] protected string $theme; - /** - * @ORM\Column(name="author", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'author', type: 'text', nullable: false)] protected string $author; - /** - * @ORM\Column(name="prerequisite", type="integer", nullable=false) - */ + #[ORM\Column(name: 'prerequisite', type: 'integer', nullable: false)] protected int $prerequisite; - /** - * @ORM\Column(name="hide_toc_frame", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'hide_toc_frame', type: 'boolean', nullable: false)] protected bool $hideTocFrame; - /** - * @ORM\Column(name="seriousgame_mode", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'seriousgame_mode', type: 'boolean', nullable: false)] protected bool $seriousgameMode; - /** - * @ORM\Column(name="use_max_score", type="integer", nullable=false, options={"default":"1"}) - */ + #[ORM\Column(name: 'use_max_score', type: 'integer', nullable: false, options: ['default' => 1])] protected int $useMaxScore; - /** - * @ORM\Column(name="autolaunch", type="integer", nullable=false) - */ + #[ORM\Column(name: 'autolaunch', type: 'integer', nullable: false)] protected int $autolaunch; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpCategory", inversedBy="lps") - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CLpCategory::class, inversedBy: 'lps')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid')] protected ?CLpCategory $category = null; - /** - * @ORM\Column(name="max_attempts", type="integer", nullable=false) - */ + #[ORM\Column(name: 'max_attempts', type: 'integer', nullable: false)] protected int $maxAttempts; - /** - * @ORM\Column(name="subscribe_users", type="integer", nullable=false) - */ + #[ORM\Column(name: 'subscribe_users', type: 'integer', nullable: false)] protected int $subscribeUsers; - /** - * @Gedmo\Timestampable(on="create") - * - * @ORM\Column(name="created_on", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_on', type: 'datetime', nullable: false)] protected DateTime $createdOn; - /** - * @Gedmo\Timestampable(on="update") - * - * @ORM\Column(name="modified_on", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'modified_on', type: 'datetime', nullable: false)] protected DateTime $modifiedOn; - /** - * @ORM\Column(name="published_on", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'published_on', type: 'datetime', nullable: true)] protected ?DateTime $publishedOn; - /** - * @ORM\Column(name="expired_on", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'expired_on', type: 'datetime', nullable: true)] protected ?DateTime $expiredOn = null; - /** - * @ORM\Column(name="accumulate_scorm_time", type="integer", nullable=false, options={"default":1}) - */ + #[ORM\Column(name: 'accumulate_scorm_time', type: 'integer', nullable: false, options: ['default' => 1])] protected int $accumulateScormTime; - /** - * @ORM\Column(name="accumulate_work_time", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: 'accumulate_work_time', type: 'integer', nullable: false, options: ['default' => 0])] protected int $accumulateWorkTime; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="lp", cascade={"persist", "remove"}, orphanRemoval=true) - */ + #[ORM\OneToMany(targetEntity: CLpItem::class, mappedBy: 'lp', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $items; /** * @var Collection|CForum[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForum", mappedBy="lp", cascade={"persist", "remove"}) */ + #[ORM\OneToMany(targetEntity: CForum::class, mappedBy: 'lp', cascade: ['persist', 'remove'])] protected Collection $forums; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"persist", "remove"}) - * @ORM\JoinColumn(name="asset_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Asset::class, cascade: ['persist', 'remove'])] + #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id')] protected ?Asset $asset = null; public function __construct() @@ -714,7 +641,7 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou /** * @return CLpItem[]|Collection */ - public function getItems() + public function getItems(): array|\Doctrine\Common\Collections\Collection { return $this->items; } @@ -749,17 +676,15 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou /** * @return ArrayCollection|Collection|CForum[] */ - public function getForums() + public function getForums(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection|array { return $this->forums; } /** * @param ArrayCollection|Collection $forums - * - * @return CLp */ - public function setForums($forums): self + public function setForums(\Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection $forums): self { $this->forums = $forums; diff --git a/src/CourseBundle/Entity/CLpCategory.php b/src/CourseBundle/Entity/CLpCategory.php index e2b7a4deb5..4cbbe31102 100644 --- a/src/CourseBundle/Entity/CLpCategory.php +++ b/src/CourseBundle/Entity/CLpCategory.php @@ -18,50 +18,34 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Learning paths categories. - * - * @ORM\Table( - * name="c_lp_category", - * ) - * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository") */ -class CLpCategory extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_lp_category')] +#[ORM\Entity(repositoryClass: \Gedmo\Sortable\Entity\Repository\SortableRepository::class)] +class CLpCategory extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $iid = null; - /** - * @ORM\Column(name="name", type="text") - */ #[Assert\NotBlank] + #[ORM\Column(name: 'name', type: 'text')] protected string $name; - /** - * @Gedmo\SortablePosition - * @ORM\Column(name="position", type="integer") - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; /** * @var Collection|CLpCategoryUser[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CLpCategoryUser", - * mappedBy="category", - * cascade={"persist", "remove"}, - * orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CLpCategoryUser::class, mappedBy: 'category', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $users; /** * @var Collection|CLp[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLp", mappedBy="category", cascade={"detach"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CLp::class, mappedBy: 'category', cascade: ['detach'])] protected Collection $lps; public function __construct() @@ -113,7 +97,7 @@ class CLpCategory extends AbstractResource implements ResourceInterface /** * @return Collection|CLp[] */ - public function getLps() + public function getLps(): \Doctrine\Common\Collections\Collection|array { return $this->lps; } diff --git a/src/CourseBundle/Entity/CLpCategoryRelUserGroup.php b/src/CourseBundle/Entity/CLpCategoryRelUserGroup.php index bd08b25871..6419bfa26b 100644 --- a/src/CourseBundle/Entity/CLpCategoryRelUserGroup.php +++ b/src/CourseBundle/Entity/CLpCategoryRelUserGroup.php @@ -15,51 +15,35 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table(name="c_lp_category_rel_usergroup") - * ORM\Entity - */ +#[ORM\Table(name: 'c_lp_category_rel_usergroup')] class CLpCategoryRelUserGroup { use CourseTrait; use SessionTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpCategory") - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CLpCategory::class)] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid')] protected CLpCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true) - */ + #[ORM\ManyToOne(targetEntity: Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true)] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", nullable=true) - */ + #[ORM\ManyToOne(targetEntity: Usergroup::class)] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', nullable: true)] protected ?Usergroup $userGroup = null; - /** - * @Gedmo\Timestampable(on="create") - * - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; public function __construct() diff --git a/src/CourseBundle/Entity/CLpCategoryUser.php b/src/CourseBundle/Entity/CLpCategoryUser.php index 02ff5aeace..ba428f57b5 100644 --- a/src/CourseBundle/Entity/CLpCategoryUser.php +++ b/src/CourseBundle/Entity/CLpCategoryUser.php @@ -12,31 +12,24 @@ use Doctrine\ORM\Mapping as ORM; /** * CLpCategoryUser. - * - * @ORM\Table(name="c_lp_category_user") - * @ORM\Entity */ -class CLpCategoryUser +#[ORM\Table(name: 'c_lp_category_user')] +#[ORM\Entity] +class CLpCategoryUser implements \Stringable { use UserTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpCategory", inversedBy="users") - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLpCategory::class, inversedBy: 'users')] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid')] protected CLpCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; public function __toString(): string diff --git a/src/CourseBundle/Entity/CLpItem.php b/src/CourseBundle/Entity/CLpItem.php index 4e6c8408b7..48f64c4b8f 100644 --- a/src/CourseBundle/Entity/CLpItem.php +++ b/src/CourseBundle/Entity/CLpItem.php @@ -14,159 +14,102 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Items from a learning path (LP). - * - * @Gedmo\Tree(type="nested") - * @ORM\Table( - * name="c_lp_item", - * indexes={ - * @ORM\Index(name="lp_id", columns={"lp_id"}), - * } - * ) - * @ORM\Entity */ -class CLpItem +#[ORM\Table(name: 'c_lp_item')] +#[ORM\Index(name: 'lp_id', columns: ['lp_id'])] +#[Gedmo\Tree(type: 'nested')] +#[ORM\Entity] +class CLpItem implements \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $iid = null; - /** - * @ORM\Column(name="title", type="string", length=511, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 511, nullable: false)] protected string $title; - /** - * @ORM\Column(name="item_type", type="string", length=32, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'item_type', type: 'string', length: 32, nullable: false)] protected string $itemType; - /** - * @ORM\Column(name="ref", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'ref', type: 'text', nullable: false)] protected string $ref; - /** - * @ORM\Column(name="description", type="string", length=511, nullable=true) - */ + #[ORM\Column(name: 'description', type: 'string', length: 511, nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="path", type="text", nullable=false) - */ + #[ORM\Column(name: 'path', type: 'text', nullable: false)] protected string $path; - /** - * @ORM\Column(name="min_score", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'min_score', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $minScore; - /** - * @ORM\Column(name="max_score", type="float", precision=10, scale=0, nullable=true, options={"default":"100"}) - */ + #[ORM\Column(name: 'max_score', type: 'float', precision: 10, scale: 0, nullable: true, options: ['default' => 100])] protected ?float $maxScore; - /** - * @ORM\Column(name="mastery_score", type="float", precision=10, scale=0, nullable=true) - */ + #[ORM\Column(name: 'mastery_score', type: 'float', precision: 10, scale: 0, nullable: true)] protected ?float $masteryScore = null; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false)] protected int $displayOrder; - /** - * @ORM\Column(name="prerequisite", type="text", nullable=true) - */ + #[ORM\Column(name: 'prerequisite', type: 'text', nullable: true)] protected ?string $prerequisite = null; - /** - * @ORM\Column(name="parameters", type="text", nullable=true) - */ + #[ORM\Column(name: 'parameters', type: 'text', nullable: true)] protected ?string $parameters = null; - /** - * @ORM\Column(name="launch_data", type="text", nullable=false) - */ + #[ORM\Column(name: 'launch_data', type: 'text', nullable: false)] protected string $launchData; - /** - * @ORM\Column(name="max_time_allowed", type="string", length=13, nullable=true) - */ + #[ORM\Column(name: 'max_time_allowed', type: 'string', length: 13, nullable: true)] protected ?string $maxTimeAllowed = null; - /** - * @ORM\Column(name="terms", type="text", nullable=true) - */ + #[ORM\Column(name: 'terms', type: 'text', nullable: true)] protected ?string $terms = null; - /** - * @ORM\Column(name="search_did", type="integer", nullable=true) - */ + #[ORM\Column(name: 'search_did', type: 'integer', nullable: true)] protected ?int $searchDid = null; - /** - * @ORM\Column(name="audio", type="string", length=250, nullable=true) - */ + #[ORM\Column(name: 'audio', type: 'string', length: 250, nullable: true)] protected ?string $audio = null; - /** - * @ORM\Column(name="prerequisite_min_score", type="float", precision=10, scale=0, nullable=true) - */ + #[ORM\Column(name: 'prerequisite_min_score', type: 'float', precision: 10, scale: 0, nullable: true)] protected ?float $prerequisiteMinScore = null; - /** - * @ORM\Column(name="prerequisite_max_score", type="float", precision=10, scale=0, nullable=true) - */ + #[ORM\Column(name: 'prerequisite_max_score', type: 'float', precision: 10, scale: 0, nullable: true)] protected ?float $prerequisiteMaxScore = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp", inversedBy="items", cascade={"persist", "remove"}) - * @ORM\JoinColumn(name="lp_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLp::class, inversedBy: 'items', cascade: ['persist', 'remove'])] + #[ORM\JoinColumn(name: 'lp_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CLp $lp; - /** - * @Gedmo\TreeRoot - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem") - * @ORM\JoinColumn(name="item_root", referencedColumnName="iid", onDelete="CASCADE") - */ + #[Gedmo\TreeRoot] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLpItem::class)] + #[ORM\JoinColumn(name: 'item_root', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected ?CLpItem $root = null; - /** - * @Gedmo\TreeParent - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", inversedBy="children", cascade={"persist"}) - * @ORM\JoinColumn(name="parent_item_id", referencedColumnName="iid", onDelete="SET NULL") - */ + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLpItem::class, inversedBy: 'children', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'parent_item_id', referencedColumnName: 'iid', onDelete: 'SET NULL')] protected ?CLpItem $parent = null; - /** - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpItem", mappedBy="parent") - */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CLpItem::class, mappedBy: 'parent')] protected Collection $children; - /** - * @Gedmo\TreeLeft - * @ORM\Column(name="previous_item_id", type="integer", nullable=true) - */ + #[Gedmo\TreeLeft] + #[ORM\Column(name: 'previous_item_id', type: 'integer', nullable: true)] protected ?int $previousItemId = null; - /** - * @Gedmo\TreeRight - * @ORM\Column(name="next_item_id", type="integer", nullable=true) - */ + #[Gedmo\TreeRight] + #[ORM\Column(name: 'next_item_id', type: 'integer', nullable: true)] protected ?int $nextItemId = null; - /** - * @Gedmo\TreeLevel - * @ORM\Column(name="lvl", type="integer") - */ + #[Gedmo\TreeLevel] + #[ORM\Column(name: 'lvl', type: 'integer')] protected ?int $lvl; public function __construct() @@ -548,7 +491,7 @@ class CLpItem /** * @return CLpItem[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } @@ -556,7 +499,7 @@ class CLpItem /** * @param CLpItem[]|Collection $children */ - public function setChildren(Collection $children): self + public function setChildren(array|\Doctrine\Common\Collections\Collection $children): self { $this->children = $children; diff --git a/src/CourseBundle/Entity/CLpItemView.php b/src/CourseBundle/Entity/CLpItemView.php index 9467061189..3eed3a2eea 100644 --- a/src/CourseBundle/Entity/CLpItemView.php +++ b/src/CourseBundle/Entity/CLpItemView.php @@ -10,80 +10,51 @@ use Doctrine\ORM\Mapping as ORM; /** * CLpItemView. - * - * @ORM\Table( - * name="c_lp_item_view", - * indexes={ - * @ORM\Index(name="lp_item_id", columns={"lp_item_id"}), - * @ORM\Index(name="lp_view_id", columns={"lp_view_id"}), - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_lp_item_view')] +#[ORM\Index(name: 'lp_item_id', columns: ['lp_item_id'])] +#[ORM\Index(name: 'lp_view_id', columns: ['lp_view_id'])] +#[ORM\Entity] class CLpItemView { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpItem") - * @ORM\JoinColumn(name="lp_item_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CLpItem::class)] + #[ORM\JoinColumn(name: 'lp_item_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CLpItem $item; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpView") - * @ORM\JoinColumn(name="lp_view_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CLpView::class)] + #[ORM\JoinColumn(name: 'lp_view_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CLpView $view; - /** - * @ORM\Column(name="view_count", type="integer", nullable=false) - */ + #[ORM\Column(name: 'view_count', type: 'integer', nullable: false)] protected int $viewCount; - /** - * @ORM\Column(name="start_time", type="integer", nullable=false) - */ + #[ORM\Column(name: 'start_time', type: 'integer', nullable: false)] protected int $startTime; - /** - * @ORM\Column(name="total_time", type="integer", nullable=false) - */ + #[ORM\Column(name: 'total_time', type: 'integer', nullable: false)] protected int $totalTime; - /** - * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $score; - /** - * @ORM\Column(name="status", type="string", length=32, nullable=false, options={"default":"not attempted"}) - */ + #[ORM\Column(name: 'status', type: 'string', length: 32, nullable: false, options: ['default' => 'not attempted'])] protected string $status; - /** - * @ORM\Column(name="suspend_data", type="text", nullable=true) - */ + #[ORM\Column(name: 'suspend_data', type: 'text', nullable: true)] protected ?string $suspendData = null; - /** - * @ORM\Column(name="lesson_location", type="text", nullable=true) - */ + #[ORM\Column(name: 'lesson_location', type: 'text', nullable: true)] protected ?string $lessonLocation = null; - /** - * @ORM\Column(name="core_exit", type="string", length=32, nullable=false, options={"default":"none"}) - */ + #[ORM\Column(name: 'core_exit', type: 'string', length: 32, nullable: false, options: ['default' => 'none'])] protected string $coreExit; - /** - * @ORM\Column(name="max_score", type="string", length=8, nullable=true) - */ + #[ORM\Column(name: 'max_score', type: 'string', length: 8, nullable: true)] protected ?string $maxScore = null; public function __construct() diff --git a/src/CourseBundle/Entity/CLpIvInteraction.php b/src/CourseBundle/Entity/CLpIvInteraction.php index acab731fad..68be918f9e 100644 --- a/src/CourseBundle/Entity/CLpIvInteraction.php +++ b/src/CourseBundle/Entity/CLpIvInteraction.php @@ -10,78 +10,49 @@ use Doctrine\ORM\Mapping as ORM; /** * CLpIvInteraction. - * - * @ORM\Table( - * name="c_lp_iv_interaction", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="lp_iv_id", columns={"lp_iv_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_lp_iv_interaction')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'lp_iv_id', columns: ['lp_iv_id'])] +#[ORM\Entity] class CLpIvInteraction { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="order_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'order_id', type: 'integer', nullable: false)] protected int $orderId; - /** - * @ORM\Column(name="lp_iv_id", type="bigint", nullable=false) - */ + #[ORM\Column(name: 'lp_iv_id', type: 'bigint', nullable: false)] protected int $lpIvId; - /** - * @ORM\Column(name="interaction_id", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'interaction_id', type: 'string', length: 255, nullable: false)] protected string $interactionId; - /** - * @ORM\Column(name="interaction_type", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'interaction_type', type: 'string', length: 255, nullable: false)] protected string $interactionType; - /** - * @ORM\Column(name="weighting", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'weighting', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $weighting; - /** - * @ORM\Column(name="completion_time", type="string", length=16, nullable=false) - */ + #[ORM\Column(name: 'completion_time', type: 'string', length: 16, nullable: false)] protected string $completionTime; - /** - * @ORM\Column(name="correct_responses", type="text", nullable=false) - */ + #[ORM\Column(name: 'correct_responses', type: 'text', nullable: false)] protected string $correctResponses; - /** - * @ORM\Column(name="student_response", type="text", nullable=false) - */ + #[ORM\Column(name: 'student_response', type: 'text', nullable: false)] protected string $studentResponse; - /** - * @ORM\Column(name="result", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'result', type: 'string', length: 255, nullable: false)] protected string $result; - /** - * @ORM\Column(name="latency", type="string", length=16, nullable=false) - */ + #[ORM\Column(name: 'latency', type: 'string', length: 16, nullable: false)] protected string $latency; /** diff --git a/src/CourseBundle/Entity/CLpIvObjective.php b/src/CourseBundle/Entity/CLpIvObjective.php index 4e0cbfcab0..794a1b2068 100644 --- a/src/CourseBundle/Entity/CLpIvObjective.php +++ b/src/CourseBundle/Entity/CLpIvObjective.php @@ -10,63 +10,40 @@ use Doctrine\ORM\Mapping as ORM; /** * CLpIvObjective. - * - * @ORM\Table( - * name="c_lp_iv_objective", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="lp_iv_id", columns={"lp_iv_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_lp_iv_objective')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'lp_iv_id', columns: ['lp_iv_id'])] +#[ORM\Entity] class CLpIvObjective { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="lp_iv_id", type="bigint", nullable=false) - */ + #[ORM\Column(name: 'lp_iv_id', type: 'bigint', nullable: false)] protected int $lpIvId; - /** - * @ORM\Column(name="order_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'order_id', type: 'integer', nullable: false)] protected int $orderId; - /** - * @ORM\Column(name="objective_id", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'objective_id', type: 'string', length: 255, nullable: false)] protected string $objectiveId; - /** - * @ORM\Column(name="score_raw", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score_raw', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $scoreRaw; - /** - * @ORM\Column(name="score_max", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score_max', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $scoreMax; - /** - * @ORM\Column(name="score_min", type="float", precision=10, scale=0, nullable=false) - */ + #[ORM\Column(name: 'score_min', type: 'float', precision: 10, scale: 0, nullable: false)] protected float $scoreMin; - /** - * @ORM\Column(name="status", type="string", length=32, nullable=false) - */ + #[ORM\Column(name: 'status', type: 'string', length: 32, nullable: false)] protected string $status; /** diff --git a/src/CourseBundle/Entity/CLpRelUserGroup.php b/src/CourseBundle/Entity/CLpRelUserGroup.php index fde81066d1..5536d4cc29 100644 --- a/src/CourseBundle/Entity/CLpRelUserGroup.php +++ b/src/CourseBundle/Entity/CLpRelUserGroup.php @@ -15,52 +15,35 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; -/** - * @ORM\Table( - * name="c_lp_rel_usergroup" - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_lp_rel_usergroup')] +#[ORM\Entity] class CLpRelUserGroup { use CourseTrait; use SessionTrait; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp") - * @ORM\JoinColumn(name="lp_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLp::class)] + #[ORM\JoinColumn(name: 'lp_id', referencedColumnName: 'iid')] protected CLp $lp; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true)] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Usergroup") - * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id", nullable=true) - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Usergroup::class)] + #[ORM\JoinColumn(name: 'usergroup_id', referencedColumnName: 'id', nullable: true)] protected ?Usergroup $userGroup = null; - /** - * @Gedmo\Timestampable(on="create") - * - * @ORM\Column(name="created_at", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)] protected DateTime $createdAt; } diff --git a/src/CourseBundle/Entity/CLpView.php b/src/CourseBundle/Entity/CLpView.php index 4620b98c92..808cdfff86 100644 --- a/src/CourseBundle/Entity/CLpView.php +++ b/src/CourseBundle/Entity/CLpView.php @@ -13,63 +13,42 @@ use Doctrine\ORM\Mapping as ORM; /** * CLpView. - * - * @ORM\Table( - * name="c_lp_view", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="lp_id", columns={"lp_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_lp_view')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'lp_id', columns: ['lp_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity] class CLpView { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp") - * @ORM\JoinColumn(name="lp_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CLp::class)] + #[ORM\JoinColumn(name: 'lp_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CLp $lp; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\Column(name="view_count", type="integer", nullable=false) - */ + #[ORM\Column(name: 'view_count', type: 'integer', nullable: false)] protected int $viewCount; - /** - * @ORM\Column(name="last_item", type="integer", nullable=false) - */ + #[ORM\Column(name: 'last_item', type: 'integer', nullable: false)] protected int $lastItem; - /** - * @ORM\Column(name="progress", type="integer", nullable=true) - */ + #[ORM\Column(name: 'progress', type: 'integer', nullable: true)] protected ?int $progress = null; public function setViewCount(int $viewCount): self diff --git a/src/CourseBundle/Entity/CNotebook.php b/src/CourseBundle/Entity/CNotebook.php index 35ba180c57..927d0e71ef 100644 --- a/src/CourseBundle/Entity/CNotebook.php +++ b/src/CourseBundle/Entity/CNotebook.php @@ -9,6 +9,7 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\User; +use Chamilo\CourseBundle\Repository\CNotebookRepository; use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; @@ -16,56 +17,37 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CNotebook. - * - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CNotebookRepository") - * @ORM\Table( - * name="c_notebook" - * ) */ -class CNotebook extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_notebook')] +#[ORM\Entity(repositoryClass: CNotebookRepository::class)] +class CNotebook extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'description', type: 'text', nullable: false)] protected string $description; - /** - * @Gedmo\Timestampable(on="create") - * - * @ORM\Column(name="creation_date", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'create')] + #[ORM\Column(name: 'creation_date', type: 'datetime', nullable: false)] protected DateTime $creationDate; - /** - * @Gedmo\Timestampable(on="update") - * - * @ORM\Column(name="update_date", type="datetime", nullable=false) - */ + #[Gedmo\Timestampable(on: 'update')] + #[ORM\Column(name: 'update_date', type: 'datetime', nullable: false)] protected DateTime $updateDate; - /** - * @ORM\Column(name="status", type="integer", nullable=true) - */ + #[ORM\Column(name: 'status', type: 'integer', nullable: true)] protected ?int $status; public function __construct() diff --git a/src/CourseBundle/Entity/CPlagiarismCompilatioDocs.php b/src/CourseBundle/Entity/CPlagiarismCompilatioDocs.php index 3cb694562e..466c8b4340 100644 --- a/src/CourseBundle/Entity/CPlagiarismCompilatioDocs.php +++ b/src/CourseBundle/Entity/CPlagiarismCompilatioDocs.php @@ -8,32 +8,22 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="c_plagiarism_compilatio_docs") - * @ORM\Entity - */ +#[ORM\Table(name: 'c_plagiarism_compilatio_docs')] +#[ORM\Entity] class CPlagiarismCompilatioDocs { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $id; - /** - * @ORM\Column(name="c_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'c_id', type: 'integer', nullable: false)] protected int $cId; - /** - * @ORM\Column(name="document_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'document_id', type: 'integer', nullable: false)] protected int $documentId; - /** - * @ORM\Column(name="compilatio_id", type="string", length=32, nullable=true) - */ + #[ORM\Column(name: 'compilatio_id', type: 'string', length: 32, nullable: true)] protected ?string $compilatioId = null; public function __construct() diff --git a/src/CourseBundle/Entity/CQuiz.php b/src/CourseBundle/Entity/CQuiz.php index fe5e82addd..bb70d915d6 100644 --- a/src/CourseBundle/Entity/CQuiz.php +++ b/src/CourseBundle/Entity/CQuiz.php @@ -10,6 +10,7 @@ use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; use Chamilo\CoreBundle\Entity\TrackEExercise; +use Chamilo\CourseBundle\Repository\CQuizRepository; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -19,198 +20,128 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Course quizzes. - * - * @ORM\Table( - * name="c_quiz", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CQuizRepository") */ -class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_quiz')] +#[ORM\Entity(repositoryClass: CQuizRepository::class)] +class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { public const ALL_ON_ONE_PAGE = 1; public const ONE_PER_PAGE = 2; - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['track_e_exercise:read'])] + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="sound", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'sound', type: 'string', length: 255, nullable: true)] protected ?string $sound = null; - /** - * @ORM\Column(name="type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'integer', nullable: false)] protected int $type; - /** - * @ORM\Column(name="random", type="integer", nullable=false) - */ + #[ORM\Column(name: 'random', type: 'integer', nullable: false)] protected int $random; - /** - * @ORM\Column(name="random_answers", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'random_answers', type: 'boolean', nullable: false)] protected bool $randomAnswers; - /** - * @ORM\Column(name="active", type="integer", nullable=false) - */ + #[ORM\Column(name: 'active', type: 'integer', nullable: false)] protected int $active; - /** - * @ORM\Column(name="results_disabled", type="integer", nullable=false) - */ + #[ORM\Column(name: 'results_disabled', type: 'integer', nullable: false)] protected int $resultsDisabled; - /** - * @ORM\Column(name="access_condition", type="text", nullable=true) - */ + #[ORM\Column(name: 'access_condition', type: 'text', nullable: true)] protected ?string $accessCondition = null; - /** - * @ORM\Column(name="max_attempt", type="integer", nullable=false) - */ + #[ORM\Column(name: 'max_attempt', type: 'integer', nullable: false)] protected int $maxAttempt; - /** - * @ORM\Column(name="start_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'start_time', type: 'datetime', nullable: true)] protected ?DateTime $startTime = null; - /** - * @ORM\Column(name="end_time", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'end_time', type: 'datetime', nullable: true)] protected ?DateTime $endTime = null; - /** - * @ORM\Column(name="feedback_type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'feedback_type', type: 'integer', nullable: false)] protected int $feedbackType; - /** - * @ORM\Column(name="expired_time", type="integer", nullable=false) - */ + #[ORM\Column(name: 'expired_time', type: 'integer', nullable: false)] protected int $expiredTime; - /** - * @ORM\Column(name="propagate_neg", type="integer", nullable=false) - */ + #[ORM\Column(name: 'propagate_neg', type: 'integer', nullable: false)] protected int $propagateNeg; - /** - * @ORm\Column(name="save_correct_answers", type="integer", nullable=true) - */ + #[ORm\Column(name: 'save_correct_answers', type: 'integer', nullable: true)] protected ?int $saveCorrectAnswers; - /** - * @ORM\Column(name="review_answers", type="integer", nullable=false) - */ + #[ORM\Column(name: 'review_answers', type: 'integer', nullable: false)] protected int $reviewAnswers; - /** - * @ORM\Column(name="random_by_category", type="integer", nullable=false) - */ + #[ORM\Column(name: 'random_by_category', type: 'integer', nullable: false)] protected int $randomByCategory; - /** - * @ORM\Column(name="text_when_finished", type="text", nullable=true) - */ + #[ORM\Column(name: 'text_when_finished', type: 'text', nullable: true)] protected ?string $textWhenFinished = null; - /** - * @ORM\Column(name="display_category_name", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_category_name', type: 'integer', nullable: false)] protected int $displayCategoryName; - /** - * @ORM\Column(name="pass_percentage", type="integer", nullable=true) - */ + #[ORM\Column(name: 'pass_percentage', type: 'integer', nullable: true)] protected ?int $passPercentage = null; - /** - * @ORM\Column(name="prevent_backwards", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: 'prevent_backwards', type: 'integer', nullable: false, options: ['default' => 0])] protected int $preventBackwards; - /** - * @ORM\Column(name="question_selection_type", type="integer", nullable=true) - */ + #[ORM\Column(name: 'question_selection_type', type: 'integer', nullable: true)] protected ?int $questionSelectionType = null; - /** - * @ORM\Column(name="hide_question_number", type="integer", nullable=false, options={"default":0}) - */ + #[ORM\Column(name: 'hide_question_number', type: 'integer', nullable: false, options: ['default' => 0])] protected int $hideQuestionNumber; - /** - * @ORM\Column(name="hide_question_title", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'hide_question_title', type: 'boolean', nullable: false)] protected bool $hideQuestionTitle; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", cascade={"persist"}) - * @ORM\JoinColumn(name="exercise_category_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CExerciseCategory::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'exercise_category_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?CExerciseCategory $exerciseCategory = null; - /** - * @ORM\Column(name="show_previous_button", type="boolean", nullable=false, options={"default":1}) - */ + #[ORM\Column(name: 'show_previous_button', type: 'boolean', nullable: false, options: ['default' => 1])] protected bool $showPreviousButton; - /** - * @ORM\Column(name="notifications", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'notifications', type: 'string', length: 255, nullable: true)] protected ?string $notifications; - /** - * @ORM\Column(name="autolaunch", type="boolean", nullable=true, options={"default":0}) - */ + #[ORM\Column(name: 'autolaunch', type: 'boolean', nullable: true, options: ['default' => 0])] protected ?bool $autoLaunch; - /** - * @ORM\Column(name="page_result_configuration", type="array") - */ + #[ORM\Column(name: 'page_result_configuration', type: 'array')] protected array $pageResultConfiguration = []; /** * @var Collection|CQuizRelQuestion[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizRelQuestion", mappedBy="quiz", cascade={"persist"}, orphanRemoval=true)) */ + #[ORM\OneToMany(targetEntity: CQuizRelQuestion::class, mappedBy: 'quiz', cascade: ['persist'], orphanRemoval: true)] protected Collection $questions; /** * @var Collection|CQuizRelQuestionCategory[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizRelQuestionCategory", mappedBy="quiz", cascade={"persist"})) */ + #[ORM\OneToMany(targetEntity: CQuizRelQuestionCategory::class, mappedBy: 'quiz', cascade: ['persist'])] protected Collection $questionsCategories; /** * @var Collection - * - * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEExercise", mappedBy="quiz") */ + #[ORM\OneToMany(targetEntity: TrackEExercise::class, mappedBy: 'quiz')] protected Collection $attempts; public function __construct() @@ -248,7 +179,7 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC /** * @return Collection|CQuizRelQuestion[] */ - public function getQuestions() + public function getQuestions(): \Doctrine\Common\Collections\Collection|array { return $this->questions; } @@ -730,7 +661,7 @@ class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowC /** * @return CQuizRelQuestionCategory[]|Collection */ - public function getQuestionsCategories() + public function getQuestionsCategories(): array|\Doctrine\Common\Collections\Collection { return $this->questionsCategories; } diff --git a/src/CourseBundle/Entity/CQuizAnswer.php b/src/CourseBundle/Entity/CQuizAnswer.php index 6dd1edb00f..5f8d34c82b 100644 --- a/src/CourseBundle/Entity/CQuizAnswer.php +++ b/src/CourseBundle/Entity/CQuizAnswer.php @@ -11,75 +11,48 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CQuizAnswer. - * - * @ORM\Table( - * name="c_quiz_answer", - * indexes={ - * @ORM\Index(name="idx_cqa_q", columns={"question_id"}), - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_quiz_answer')] +#[ORM\Index(name: 'idx_cqa_q', columns: ['question_id'])] +#[ORM\Entity] class CQuizAnswer { - /** - * @ORM\Column(name="iid", type="integer", options={"unsigned": true}) - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer', options: ['unsigned' => true])] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestion", inversedBy="answers", cascade={"persist"}) - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") - */ #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuizQuestion::class, inversedBy: 'answers', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuizQuestion $question; - /** - * @ORM\Column(name="answer", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'answer', type: 'text', nullable: false)] protected string $answer; - /** - * @ORM\Column(name="correct", type="integer", nullable=true) - */ + #[ORM\Column(name: 'correct', type: 'integer', nullable: true)] protected ?int $correct; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment; - /** - * @ORM\Column(name="ponderation", type="float", precision=6, scale=2, nullable=false, options={"default": 0}) - */ + #[ORM\Column(name: 'ponderation', type: 'float', precision: 6, scale: 2, nullable: false, options: ['default' => 0])] protected float $ponderation; - /** - * @ORM\Column(name="position", type="integer", nullable=false) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: false)] protected int $position; - /** - * @ORM\Column(name="hotspot_coordinates", type="text", nullable=true) - */ + #[ORM\Column(name: 'hotspot_coordinates', type: 'text', nullable: true)] protected ?string $hotspotCoordinates; - /** - * @ORM\Column(name="hotspot_type", type="string", length=40, nullable=true) - */ + #[ORM\Column(name: 'hotspot_type', type: 'string', length: 40, nullable: true)] protected ?string $hotspotType; - /** - * @ORM\Column(name="destination", type="text", nullable=true) - */ + #[ORM\Column(name: 'destination', type: 'text', nullable: true)] protected ?string $destination; - /** - * @ORM\Column(name="answer_code", type="string", length=10, nullable=true) - */ + #[ORM\Column(name: 'answer_code', type: 'string', length: 10, nullable: true)] protected ?string $answerCode; public function __construct() diff --git a/src/CourseBundle/Entity/CQuizQuestion.php b/src/CourseBundle/Entity/CQuizQuestion.php index f6275772a7..33d5d479e9 100644 --- a/src/CourseBundle/Entity/CQuizQuestion.php +++ b/src/CourseBundle/Entity/CQuizQuestion.php @@ -8,6 +8,7 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CQuizQuestionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -15,114 +16,76 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CQuizQuestion. - * - * @ORM\Table( - * name="c_quiz_question", - * indexes={ - * @ORM\Index(name="position", columns={"position"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CQuizQuestionRepository") */ -class CQuizQuestion extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_quiz_question')] +#[ORM\Index(name: 'position', columns: ['position'])] +#[ORM\Entity(repositoryClass: CQuizQuestionRepository::class)] +class CQuizQuestion extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="question", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'question', type: 'text', nullable: false)] protected string $question; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="ponderation", type="float", precision=6, scale=2, nullable=false, options={"default": 0}) - */ + #[ORM\Column(name: 'ponderation', type: 'float', precision: 6, scale: 2, nullable: false, options: ['default' => 0])] protected float $ponderation; - /** - * @ORM\Column(name="position", type="integer", nullable=false) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: false)] protected int $position; - /** - * @ORM\Column(name="type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'integer', nullable: false)] protected int $type; - /** - * @ORM\Column(name="picture", type="string", length=50, nullable=true) - */ + #[ORM\Column(name: 'picture', type: 'string', length: 50, nullable: true)] protected ?string $picture = null; - /** - * @ORM\Column(name="level", type="integer", nullable=false) - */ + #[ORM\Column(name: 'level', type: 'integer', nullable: false)] protected int $level; - /** - * @ORM\Column(name="feedback", type="text", nullable=true) - */ + #[ORM\Column(name: 'feedback', type: 'text', nullable: true)] protected ?string $feedback = null; - /** - * @ORM\Column(name="extra", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'extra', type: 'string', length: 255, nullable: true)] protected ?string $extra = null; - /** - * @ORM\Column(name="question_code", type="string", length=10, nullable=true) - */ + #[ORM\Column(name: 'question_code', type: 'string', length: 10, nullable: true)] protected ?string $questionCode = null; /** * @var Collection|CQuizQuestionCategory[] - * - * @ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestionCategory", inversedBy="questions") - * @ORM\JoinTable(name="c_quiz_question_rel_category", - * joinColumns={ - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid") - * }, - * inverseJoinColumns={ - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid") - * } - * ) */ + #[ORM\JoinTable(name: 'c_quiz_question_rel_category')] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid')] + #[ORM\InverseJoinColumn(name: 'category_id', referencedColumnName: 'iid')] + #[ORM\ManyToMany(targetEntity: CQuizQuestionCategory::class, inversedBy: 'questions')] protected Collection $categories; /** * @var Collection|CQuizRelQuestion[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizRelQuestion", mappedBy="question", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: CQuizRelQuestion::class, mappedBy: 'question', cascade: ['persist'])] protected Collection $relQuizzes; /** * @var Collection|CQuizAnswer[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizAnswer", mappedBy="question", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: CQuizAnswer::class, mappedBy: 'question', cascade: ['persist'])] protected Collection $answers; /** * @var Collection|CQuizQuestionOption[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestionOption", mappedBy="question", cascade={"persist"}) */ + #[ORM\OneToMany(targetEntity: CQuizQuestionOption::class, mappedBy: 'question', cascade: ['persist'])] protected Collection $options; - /** - * @ORM\Column(name="mandatory", type="integer") - */ + #[ORM\Column(name: 'mandatory', type: 'integer')] protected int $mandatory; public function __construct() @@ -335,7 +298,7 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface /** * @return CQuizQuestionCategory[]|Collection */ - public function getCategories() + public function getCategories(): array|\Doctrine\Common\Collections\Collection { return $this->categories; } @@ -343,7 +306,7 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface /** * @return CQuizRelQuestion[]|Collection */ - public function getRelQuizzes() + public function getRelQuizzes(): array|\Doctrine\Common\Collections\Collection { return $this->relQuizzes; } @@ -351,7 +314,7 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface /** * @return CQuizAnswer[]|Collection */ - public function getAnswers() + public function getAnswers(): array|\Doctrine\Common\Collections\Collection { return $this->answers; } @@ -364,7 +327,7 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface /** * @return CQuizQuestionOption[]|Collection */ - public function getOptions() + public function getOptions(): array|\Doctrine\Common\Collections\Collection { return $this->options; } @@ -372,7 +335,7 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface /** * @param CQuizQuestionOption[]|Collection $options */ - public function setOptions(Collection $options): self + public function setOptions(array|\Doctrine\Common\Collections\Collection $options): self { $this->options = $options; diff --git a/src/CourseBundle/Entity/CQuizQuestionCategory.php b/src/CourseBundle/Entity/CQuizQuestionCategory.php index 7ddb2cba38..ba6c2b5488 100644 --- a/src/CourseBundle/Entity/CQuizQuestionCategory.php +++ b/src/CourseBundle/Entity/CQuizQuestionCategory.php @@ -14,39 +14,26 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_quiz_question_category", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository") - */ -class CQuizQuestionCategory extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_quiz_question_category')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository::class)] +class CQuizQuestionCategory extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; /** * @var Collection|CQuizQuestion[] - * - * @ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestion", mappedBy="categories") */ + #[ORM\ManyToMany(targetEntity: \Chamilo\CourseBundle\Entity\CQuizQuestion::class, mappedBy: 'categories')] protected Collection $questions; public function __construct() @@ -116,7 +103,7 @@ class CQuizQuestionCategory extends AbstractResource implements ResourceInterfac /** * @return Collection|CQuizQuestion[] */ - public function getQuestions() + public function getQuestions(): \Doctrine\Common\Collections\Collection|array { return $this->questions; } @@ -124,7 +111,7 @@ class CQuizQuestionCategory extends AbstractResource implements ResourceInterfac /** * @param Collection|CQuizQuestion[] $questions */ - public function setQuestions(Collection $questions): self + public function setQuestions(\Doctrine\Common\Collections\Collection|array $questions): self { $this->questions = $questions; diff --git a/src/CourseBundle/Entity/CQuizQuestionOption.php b/src/CourseBundle/Entity/CQuizQuestionOption.php index 0c027e2dd2..bc8c3ffc62 100644 --- a/src/CourseBundle/Entity/CQuizQuestionOption.php +++ b/src/CourseBundle/Entity/CQuizQuestionOption.php @@ -11,38 +11,25 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CQuizQuestionOption. - * - * @ORM\Table( - * name="c_quiz_question_option", - * indexes={ - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_quiz_question_option')] +#[ORM\Entity] class CQuizQuestionOption { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\Column(name="position", type="integer", nullable=false) - */ + #[ORM\Column(name: 'position', type: 'integer', nullable: false)] protected int $position; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestion", cascade={"persist"}, inversedBy="options") - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") - */ #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: CQuizQuestion::class, cascade: ['persist'], inversedBy: 'options')] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuizQuestion $question; public function setName(string $name): self diff --git a/src/CourseBundle/Entity/CQuizRelQuestion.php b/src/CourseBundle/Entity/CQuizRelQuestion.php index f9077424cc..f1ad54a491 100644 --- a/src/CourseBundle/Entity/CQuizRelQuestion.php +++ b/src/CourseBundle/Entity/CQuizRelQuestion.php @@ -11,42 +11,29 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CQuizRelQuestion. - * - * @ORM\Table( - * name="c_quiz_rel_question", - * indexes={ - * @ORM\Index(name="question", columns={"question_id"}), - * @ORM\Index(name="exercise", columns={"quiz_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_quiz_rel_question')] +#[ORM\Index(name: 'question', columns: ['question_id'])] +#[ORM\Index(name: 'exercise', columns: ['quiz_id'])] +#[ORM\Entity] class CQuizRelQuestion { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="question_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'question_order', type: 'integer', nullable: false)] protected int $questionOrder; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestion", inversedBy="relQuizzes", cascade={"persist"}) - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") - */ #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuizQuestion::class, inversedBy: 'relQuizzes', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuizQuestion $question; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuiz", inversedBy="questions", cascade={"persist"}) - * @ORM\JoinColumn(name="quiz_id", referencedColumnName="iid", onDelete="CASCADE") - */ #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuiz::class, inversedBy: 'questions', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'quiz_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuiz $quiz; public function setQuestionOrder(int $questionOrder): self diff --git a/src/CourseBundle/Entity/CQuizRelQuestionCategory.php b/src/CourseBundle/Entity/CQuizRelQuestionCategory.php index 0afed75d70..c8e82ca620 100644 --- a/src/CourseBundle/Entity/CQuizRelQuestionCategory.php +++ b/src/CourseBundle/Entity/CQuizRelQuestionCategory.php @@ -10,34 +10,25 @@ use Doctrine\ORM\Mapping as ORM; /** * Quiz rel question categories. - * - * @ORM\Table(name="c_quiz_rel_category") - * @ORM\Entity */ +#[ORM\Table(name: 'c_quiz_rel_category')] +#[ORM\Entity] class CQuizRelQuestionCategory { - /** - * @ORM\Column(name="iid", type="bigint") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'bigint')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuizQuestionCategory", cascade={"persist"}) - * @ORM\JoinColumn(name="category_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuizQuestionCategory::class, cascade: ['persist'])] + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuizQuestionCategory $category; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CQuiz", inversedBy="questionsCategories", cascade={"persist"}) - * @ORM\JoinColumn(name="exercise_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CQuiz::class, inversedBy: 'questionsCategories', cascade: ['persist'])] + #[ORM\JoinColumn(name: 'exercise_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CQuiz $quiz; - /** - * @ORM\Column(name="count_questions", type="integer", nullable=false) - */ + #[ORM\Column(name: 'count_questions', type: 'integer', nullable: false)] protected int $countQuestions; /** diff --git a/src/CourseBundle/Entity/CShortcut.php b/src/CourseBundle/Entity/CShortcut.php index a30c968971..23d9ae8a52 100644 --- a/src/CourseBundle/Entity/CShortcut.php +++ b/src/CourseBundle/Entity/CShortcut.php @@ -13,30 +13,22 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table(name="c_shortcut") - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CShortcutRepository") - */ -class CShortcut extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_shortcut')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CShortcutRepository::class)] +class CShortcut extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] #[Groups(['cshortcut:read'])] + #[ORM\Column(name: 'name', type: 'string', length: 255, nullable: false)] protected string $name; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", inversedBy="shortCut") - * @ORM\JoinColumn(name="shortcut_node_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\OneToOne(targetEntity: \Chamilo\CoreBundle\Entity\ResourceNode::class, inversedBy: 'shortCut')] + #[ORM\JoinColumn(name: 'shortcut_node_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected ResourceNode $shortCutNode; #[Groups(['cshortcut:read'])] diff --git a/src/CourseBundle/Entity/CStudentPublication.php b/src/CourseBundle/Entity/CStudentPublication.php index a4d718bf59..398a548b10 100644 --- a/src/CourseBundle/Entity/CStudentPublication.php +++ b/src/CourseBundle/Entity/CStudentPublication.php @@ -18,144 +18,95 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CStudentPublication. - * - * @ORM\Table( - * name="c_student_publication", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CStudentPublicationRepository") */ -class CStudentPublication extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_student_publication')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CStudentPublicationRepository::class)] +class CStudentPublication extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="author", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'author', type: 'string', length: 255, nullable: true)] protected ?string $author = null; - /** - * @ORM\Column(name="active", type="integer", nullable=true) - */ + #[ORM\Column(name: 'active', type: 'integer', nullable: true)] protected ?int $active = null; - /** - * @ORM\Column(name="accepted", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'accepted', type: 'boolean', nullable: true)] protected ?bool $accepted = null; - /** - * @ORM\Column(name="post_group_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'post_group_id', type: 'integer', nullable: false)] protected int $postGroupId; - /** - * @ORM\Column(name="sent_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'sent_date', type: 'datetime', nullable: true)] protected ?DateTime $sentDate; - /** - * @ORM\Column(name="filetype", type="string", length=10, nullable=false) - */ #[Assert\NotBlank] #[Assert\Choice(callback: 'getFileTypes')] + #[ORM\Column(name: 'filetype', type: 'string', length: 10, nullable: false)] protected string $filetype; - /** - * @ORM\Column(name="has_properties", type="integer", nullable=false) - */ + #[ORM\Column(name: 'has_properties', type: 'integer', nullable: false)] protected int $hasProperties; - /** - * @ORM\Column(name="view_properties", type="boolean", nullable=true) - */ + #[ORM\Column(name: 'view_properties', type: 'boolean', nullable: true)] protected ?bool $viewProperties = null; - /** - * @ORM\Column(name="qualification", type="float", precision=6, scale=2, nullable=false) - */ + #[ORM\Column(name: 'qualification', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $qualification; - /** - * @ORM\Column(name="date_of_qualification", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'date_of_qualification', type: 'datetime', nullable: true)] protected ?DateTime $dateOfQualification = null; /** * @var Collection|CStudentPublication[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication", mappedBy="publicationParent") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CStudentPublication::class, mappedBy: 'publicationParent')] protected Collection $children; /** * @var Collection|CStudentPublicationComment[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationComment", mappedBy="publication") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CStudentPublicationComment::class, mappedBy: 'publication')] protected Collection $comments; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CStudentPublication::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'iid')] protected ?CStudentPublication $publicationParent; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] protected User $user; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationAssignment", mappedBy="publication") - */ + #[ORM\OneToOne(targetEntity: \Chamilo\CourseBundle\Entity\CStudentPublicationAssignment::class, mappedBy: 'publication')] protected ?CStudentPublicationAssignment $assignment = null; - /** - * @ORM\Column(name="qualificator_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'qualificator_id', type: 'integer', nullable: false)] protected int $qualificatorId; - /** - * @ORM\Column(name="weight", type="float", precision=6, scale=2, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'weight', type: 'float', precision: 6, scale: 2, nullable: false)] protected float $weight; - /** - * @ORM\Column(name="allow_text_assignment", type="integer", nullable=false) - */ + #[ORM\Column(name: 'allow_text_assignment', type: 'integer', nullable: false)] protected int $allowTextAssignment; - /** - * @ORM\Column(name="contains_file", type="integer", nullable=false) - */ + #[ORM\Column(name: 'contains_file', type: 'integer', nullable: false)] protected int $containsFile; - /** - * @ORM\Column(name="document_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'document_id', type: 'integer', nullable: false)] protected int $documentId; - /** - * @ORM\Column(name="filesize", type="integer", nullable=true) - */ + #[ORM\Column(name: 'filesize', type: 'integer', nullable: true)] protected ?int $fileSize = null; public function __construct() @@ -526,7 +477,7 @@ class CStudentPublication extends AbstractResource implements ResourceInterface /** * @return CStudentPublication[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } @@ -565,7 +516,7 @@ class CStudentPublication extends AbstractResource implements ResourceInterface /** * @return CStudentPublicationComment[]|Collection */ - public function getComments() + public function getComments(): array|\Doctrine\Common\Collections\Collection { return $this->comments; } @@ -573,7 +524,7 @@ class CStudentPublication extends AbstractResource implements ResourceInterface /** * @param CStudentPublicationComment[]|Collection $comments */ - public function setComments(Collection $comments): self + public function setComments(array|\Doctrine\Common\Collections\Collection $comments): self { $this->comments = $comments; diff --git a/src/CourseBundle/Entity/CStudentPublicationAssignment.php b/src/CourseBundle/Entity/CStudentPublicationAssignment.php index cfa44afff3..19bf2dac78 100644 --- a/src/CourseBundle/Entity/CStudentPublicationAssignment.php +++ b/src/CourseBundle/Entity/CStudentPublicationAssignment.php @@ -11,47 +11,30 @@ use Doctrine\ORM\Mapping as ORM; /** * CStudentPublicationAssignment. - * - * @ORM\Table( - * name="c_student_publication_assignment", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CStudentPublicationAssignmentRepository") */ -class CStudentPublicationAssignment +#[ORM\Table(name: 'c_student_publication_assignment')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CStudentPublicationAssignmentRepository::class)] +class CStudentPublicationAssignment implements \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="expires_on", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'expires_on', type: 'datetime', nullable: true)] protected ?DateTime $expiresOn = null; - /** - * @ORM\Column(name="ends_on", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'ends_on', type: 'datetime', nullable: true)] protected ?DateTime $endsOn = null; - /** - * @ORM\Column(name="add_to_calendar", type="integer", nullable=false) - */ + #[ORM\Column(name: 'add_to_calendar', type: 'integer', nullable: false)] protected int $addToCalendar; - /** - * @ORM\Column(name="enable_qualification", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'enable_qualification', type: 'boolean', nullable: false)] protected bool $enableQualification; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication", inversedBy="assignment") - * @ORM\JoinColumn(name="publication_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\OneToOne(targetEntity: \Chamilo\CourseBundle\Entity\CStudentPublication::class, inversedBy: 'assignment')] + #[ORM\JoinColumn(name: 'publication_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CStudentPublication $publication; public function __toString(): string diff --git a/src/CourseBundle/Entity/CStudentPublicationComment.php b/src/CourseBundle/Entity/CStudentPublicationComment.php index ea10cc1816..806ecf31a7 100644 --- a/src/CourseBundle/Entity/CStudentPublicationComment.php +++ b/src/CourseBundle/Entity/CStudentPublicationComment.php @@ -9,54 +9,38 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\User; +use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository; use Cocur\Slugify\Slugify; use DateTime; use Doctrine\ORM\Mapping as ORM; /** * CStudentPublicationComment. - * - * @ORM\Table( - * name="c_student_publication_comment", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository") */ -class CStudentPublicationComment extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_student_publication_comment')] +#[ORM\Entity(repositoryClass: CStudentPublicationCommentRepository::class)] +class CStudentPublicationComment extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication", inversedBy="comments") - * @ORM\JoinColumn(name="work_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CStudentPublication::class, inversedBy: 'comments')] + #[ORM\JoinColumn(name: 'work_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CStudentPublication $publication; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: true)] protected ?string $comment = null; - /** - * @ORM\Column(name="file", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'file', type: 'string', length: 255, nullable: true)] protected ?string $file = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; - /** - * @ORM\Column(name="sent_at", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'sent_at', type: 'datetime', nullable: false)] protected DateTime $sentAt; public function __construct() diff --git a/src/CourseBundle/Entity/CStudentPublicationCorrection.php b/src/CourseBundle/Entity/CStudentPublicationCorrection.php index c071ce49ac..d556d1b22d 100644 --- a/src/CourseBundle/Entity/CStudentPublicationCorrection.php +++ b/src/CourseBundle/Entity/CStudentPublicationCorrection.php @@ -8,28 +8,21 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\ResourceInterface; +use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_student_publication_correction" - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository") - */ -class CStudentPublicationCorrection extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_student_publication_correction')] +#[ORM\Entity(repositoryClass: CStudentPublicationCorrectionRepository::class)] +class CStudentPublicationCorrection extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; public function __construct() diff --git a/src/CourseBundle/Entity/CStudentPublicationRelDocument.php b/src/CourseBundle/Entity/CStudentPublicationRelDocument.php index 2b2c886592..58e3df66c1 100644 --- a/src/CourseBundle/Entity/CStudentPublicationRelDocument.php +++ b/src/CourseBundle/Entity/CStudentPublicationRelDocument.php @@ -8,33 +8,21 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_student_publication_rel_document", - * indexes={ - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_student_publication_rel_document')] +#[ORM\Entity] class CStudentPublicationRelDocument { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication") - * @ORM\JoinColumn(name="work_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CStudentPublication::class)] + #[ORM\JoinColumn(name: 'work_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CStudentPublication $publication; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CDocument") - * @ORM\JoinColumn(name="document_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CDocument::class)] + #[ORM\JoinColumn(name: 'document_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CDocument $document; public function getPublication(): CStudentPublication diff --git a/src/CourseBundle/Entity/CStudentPublicationRelUser.php b/src/CourseBundle/Entity/CStudentPublicationRelUser.php index b044cdb2e7..014bf403c5 100644 --- a/src/CourseBundle/Entity/CStudentPublicationRelUser.php +++ b/src/CourseBundle/Entity/CStudentPublicationRelUser.php @@ -9,33 +9,21 @@ namespace Chamilo\CourseBundle\Entity; use Chamilo\CoreBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_student_publication_rel_user", - * indexes={ - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_student_publication_rel_user')] +#[ORM\Entity] class CStudentPublicationRelUser { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication") - * @ORM\JoinColumn(name="work_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CStudentPublication::class)] + #[ORM\JoinColumn(name: 'work_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CStudentPublication $publication; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; public function getPublication(): CStudentPublication diff --git a/src/CourseBundle/Entity/CSurvey.php b/src/CourseBundle/Entity/CSurvey.php index e1dc509619..2275440d4d 100644 --- a/src/CourseBundle/Entity/CSurvey.php +++ b/src/CourseBundle/Entity/CSurvey.php @@ -15,210 +15,138 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Validator\Constraints as Assert; -/** - * @Gedmo\Tree(type="nested") - * @ORM\Table( - * name="c_survey", - * indexes={ - * @ORM\Index(name="idx_survey_code", columns={"code"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CSurveyRepository") - */ -class CSurvey extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_survey')] +#[ORM\Index(name: 'idx_survey_code', columns: ['code'])] +#[Gedmo\Tree(type: 'nested')] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CSurveyRepository::class)] +class CSurvey extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="code", type="string", length=40, nullable=true) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'code', type: 'string', length: 40, nullable: true)] protected ?string $code = null; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="subtitle", type="text", nullable=true) - */ + #[ORM\Column(name: 'subtitle', type: 'text', nullable: true)] protected ?string $subtitle; - /** - * @ORM\Column(name="lang", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'lang', type: 'string', length: 20, nullable: true)] protected ?string $lang; - /** - * @ORM\Column(name="avail_from", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'avail_from', type: 'datetime', nullable: true)] protected ?DateTime $availFrom = null; - /** - * @ORM\Column(name="avail_till", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'avail_till', type: 'datetime', nullable: true)] protected ?DateTime $availTill = null; - /** - * @ORM\Column(name="is_shared", type="string", length=1, nullable=true) - */ + #[ORM\Column(name: 'is_shared', type: 'string', length: 1, nullable: true)] protected ?string $isShared = null; - /** - * @ORM\Column(name="template", type="string", length=20, nullable=true) - */ + #[ORM\Column(name: 'template', type: 'string', length: 20, nullable: true)] protected ?string $template = null; - /** - * @ORM\Column(name="intro", type="text", nullable=true) - */ + #[ORM\Column(name: 'intro', type: 'text', nullable: true)] protected ?string $intro = null; - /** - * @ORM\Column(name="surveythanks", type="text", nullable=true) - */ + #[ORM\Column(name: 'surveythanks', type: 'text', nullable: true)] protected ?string $surveyThanks = null; - /** - * @ORM\Column(name="creation_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'creation_date', type: 'datetime', nullable: false)] protected DateTime $creationDate; - /** - * @ORM\Column(name="invited", type="integer", nullable=false) - */ + #[ORM\Column(name: 'invited', type: 'integer', nullable: false)] protected int $invited; - /** - * @ORM\Column(name="answered", type="integer", nullable=false) - */ + #[ORM\Column(name: 'answered', type: 'integer', nullable: false)] protected int $answered; - /** - * @ORM\Column(name="invite_mail", type="text", nullable=false) - */ + #[ORM\Column(name: 'invite_mail', type: 'text', nullable: false)] protected string $inviteMail; - /** - * @ORM\Column(name="reminder_mail", type="text", nullable=false) - */ + #[ORM\Column(name: 'reminder_mail', type: 'text', nullable: false)] protected string $reminderMail; - /** - * @ORM\Column(name="mail_subject", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'mail_subject', type: 'string', length: 255, nullable: false)] protected string $mailSubject; - /** - * @ORM\Column(name="anonymous", type="string", length=10, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'anonymous', type: 'string', length: 10, nullable: false)] protected string $anonymous; - /** - * @ORM\Column(name="access_condition", type="text", nullable=true) - */ + #[ORM\Column(name: 'access_condition', type: 'text', nullable: true)] protected ?string $accessCondition = null; - /** - * @ORM\Column(name="shuffle", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'shuffle', type: 'boolean', nullable: false)] protected bool $shuffle; - /** - * @ORM\Column(name="one_question_per_page", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'one_question_per_page', type: 'boolean', nullable: false)] protected bool $oneQuestionPerPage; - /** - * @ORM\Column(name="survey_version", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'survey_version', type: 'string', length: 255, nullable: false)] protected string $surveyVersion; - /** - * @Gedmo\TreeLeft - * @ORM\Column(name="lft", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeLeft] + #[ORM\Column(name: 'lft', type: 'integer', nullable: true, unique: false)] protected ?int $lft = null; - /** - * @Gedmo\TreeRight - * @ORM\Column(name="rgt", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeRight] + #[ORM\Column(name: 'rgt', type: 'integer', nullable: true, unique: false)] protected ?int $rgt = null; - /** - * @Gedmo\TreeLevel - * @ORM\Column(name="lvl", type="integer", nullable=true, unique=false) - */ + #[Gedmo\TreeLevel] + #[ORM\Column(name: 'lvl', type: 'integer', nullable: true, unique: false)] protected ?int $lvl = null; /** * @var Collection|CSurveyQuestion[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", mappedBy="survey", cascade={"remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CSurveyQuestion::class, mappedBy: 'survey', cascade: ['remove'])] protected Collection $questions; /** * @var Collection|CSurveyInvitation[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyInvitation", mappedBy="survey", cascade={"remove"}) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CSurveyInvitation::class, mappedBy: 'survey', cascade: ['remove'])] protected Collection $invitations; - /** - * @Gedmo\TreeParent - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurvey", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[Gedmo\TreeParent] + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CSurvey::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected ?CSurvey $surveyParent = null; /** * @var Collection|CSurvey[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurvey", mappedBy="surveyParent") */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CSurvey::class, mappedBy: 'surveyParent')] protected Collection $children; /** * @var Collection|CSurveyQuestionOption[] - * - * @ORM\OrderBy({"sort"="ASC"}) - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestionOption", mappedBy="survey", cascade={"remove"}) */ + #[ORM\OrderBy(['sort' => 'ASC'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CSurveyQuestionOption::class, mappedBy: 'survey', cascade: ['remove'])] protected Collection $options; - /** - * @ORM\Column(name="survey_type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'survey_type', type: 'integer', nullable: false)] protected int $surveyType; - /** - * @ORM\Column(name="show_form_profile", type="integer", nullable=false) - */ + #[ORM\Column(name: 'show_form_profile', type: 'integer', nullable: false)] protected int $showFormProfile; - /** - * @ORM\Column(name="form_fields", type="text", nullable=false) - */ + #[ORM\Column(name: 'form_fields', type: 'text', nullable: false)] protected string $formFields; - /** - * @ORM\Column(name="visible_results", type="integer", nullable=true) - */ + #[ORM\Column(name: 'visible_results', type: 'integer', nullable: true)] protected ?int $visibleResults = null; - /** - * @ORM\Column(name="is_mandatory", type="boolean", options={"default":false}) - */ + #[ORM\Column(name: 'is_mandatory', type: 'boolean', options: ['default' => false])] protected bool $isMandatory = false; public function __construct() @@ -674,7 +602,7 @@ class CSurvey extends AbstractResource implements ResourceInterface /** * @return CSurveyQuestion[]|Collection */ - public function getQuestions() + public function getQuestions(): array|\Doctrine\Common\Collections\Collection { return $this->questions; } @@ -737,17 +665,15 @@ class CSurvey extends AbstractResource implements ResourceInterface /** * @return CSurvey[]|Collection */ - public function getChildren() + public function getChildren(): array|\Doctrine\Common\Collections\Collection { return $this->children; } /** * @param CSurvey[]|Collection $children - * - * @return CSurvey */ - public function setChildren(Collection $children): self + public function setChildren(array|\Doctrine\Common\Collections\Collection $children): self { $this->children = $children; @@ -757,7 +683,7 @@ class CSurvey extends AbstractResource implements ResourceInterface /** * @return CSurveyQuestionOption[]|Collection */ - public function getOptions() + public function getOptions(): array|\Doctrine\Common\Collections\Collection { return $this->options; } @@ -772,7 +698,7 @@ class CSurvey extends AbstractResource implements ResourceInterface /** * @return CSurveyInvitation[]|Collection */ - public function getInvitations() + public function getInvitations(): array|\Doctrine\Common\Collections\Collection { return $this->invitations; } @@ -780,7 +706,7 @@ class CSurvey extends AbstractResource implements ResourceInterface /** * @param CSurveyInvitation[]|Collection $invitations */ - public function setInvitations($invitations): self + public function setInvitations(array|\Doctrine\Common\Collections\Collection $invitations): self { $this->invitations = $invitations; diff --git a/src/CourseBundle/Entity/CSurveyAnswer.php b/src/CourseBundle/Entity/CSurveyAnswer.php index b12b7360d1..7bcea52216 100644 --- a/src/CourseBundle/Entity/CSurveyAnswer.php +++ b/src/CourseBundle/Entity/CSurveyAnswer.php @@ -8,48 +8,30 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_survey_answer", - * indexes={ - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_survey_answer')] +#[ORM\Entity] class CSurveyAnswer { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurvey") - * @ORM\JoinColumn(name="survey_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CSurvey::class)] + #[ORM\JoinColumn(name: 'survey_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CSurvey $survey; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", inversedBy="answers") - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CSurveyQuestion::class, inversedBy: 'answers')] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid')] protected CSurveyQuestion $question; - /** - * @ORM\Column(name="option_id", type="text", nullable=false) - */ + #[ORM\Column(name: 'option_id', type: 'text', nullable: false)] protected string $optionId; - /** - * @ORM\Column(name="value", type="integer", nullable=false) - */ + #[ORM\Column(name: 'value', type: 'integer', nullable: false)] protected int $value; - /** - * @ORM\Column(name="user", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'user', type: 'string', length: 250, nullable: false)] protected string $user; public function __construct() diff --git a/src/CourseBundle/Entity/CSurveyInvitation.php b/src/CourseBundle/Entity/CSurveyInvitation.php index 03046e867e..cb28fea217 100644 --- a/src/CourseBundle/Entity/CSurveyInvitation.php +++ b/src/CourseBundle/Entity/CSurveyInvitation.php @@ -12,79 +12,51 @@ use Chamilo\CoreBundle\Entity\User; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_survey_invitation", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_survey_invitation')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity] class CSurveyInvitation { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Course $course = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="resourceLinks") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\Session::class, inversedBy: 'resourceLinks')] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroup") - * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CGroup::class)] + #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')] protected ?CGroup $group = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurvey", inversedBy="invitations") - * @ORM\JoinColumn(name="survey_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CourseBundle\Entity\CSurvey::class, inversedBy: 'invitations')] + #[ORM\JoinColumn(name: 'survey_id', referencedColumnName: 'iid')] protected CSurvey $survey; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="surveyInvitations") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: \Chamilo\CoreBundle\Entity\User::class, inversedBy: 'surveyInvitations')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; protected string $externalEmail; - /** - * @ORM\Column(name="invitation_code", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'invitation_code', type: 'string', length: 250, nullable: false)] protected string $invitationCode; - /** - * @ORM\Column(name="answered", type="integer", nullable=false) - */ + #[ORM\Column(name: 'answered', type: 'integer', nullable: false)] protected int $answered; - /** - * @ORM\Column(name="invitation_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'invitation_date', type: 'datetime', nullable: false)] protected DateTime $invitationDate; - /** - * @ORM\Column(name="reminder_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'reminder_date', type: 'datetime', nullable: true)] protected ?DateTime $reminderDate = null; - /** - * @ORM\Column(name="answered_at", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'answered_at', type: 'datetime', nullable: true)] protected ?DateTime $answeredAt = null; public function __construct() diff --git a/src/CourseBundle/Entity/CSurveyQuestion.php b/src/CourseBundle/Entity/CSurveyQuestion.php index 249205e4c7..417fdb40ba 100644 --- a/src/CourseBundle/Entity/CSurveyQuestion.php +++ b/src/CourseBundle/Entity/CSurveyQuestion.php @@ -6,119 +6,83 @@ declare(strict_types=1); namespace Chamilo\CourseBundle\Entity; +use Chamilo\CourseBundle\Repository\CSurveyQuestionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_survey_question", - * indexes={ - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CSurveyQuestionRepository") - */ +#[ORM\Table(name: 'c_survey_question')] +#[ORM\Entity(repositoryClass: CSurveyQuestionRepository::class)] class CSurveyQuestion { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="iid", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: CSurveyQuestion::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'iid', onDelete: 'SET NULL')] protected ?CSurveyQuestion $parent = null; /** * @var Collection|CSurveyQuestion[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", mappedBy="parent") */ + #[ORM\OneToMany(targetEntity: CSurveyQuestion::class, mappedBy: 'parent')] protected Collection $children; /** * @var Collection|CSurveyQuestionOption[] - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestionOption", mappedBy="question", cascade={"remove"}) */ + #[ORM\OneToMany(targetEntity: CSurveyQuestionOption::class, mappedBy: 'question', cascade: ['remove'])] protected Collection $options; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestionOption", cascade={"remove"}) - * @ORM\JoinColumn(name="parent_option_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CSurveyQuestionOption::class, cascade: ['remove'])] + #[ORM\JoinColumn(name: 'parent_option_id', referencedColumnName: 'iid')] protected ?CSurveyQuestionOption $parentOption = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurvey", inversedBy="questions") - * @ORM\JoinColumn(name="survey_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CSurvey::class, inversedBy: 'questions')] + #[ORM\JoinColumn(name: 'survey_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CSurvey $survey; /** * @var Collection|CSurveyAnswer[] - * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyAnswer", mappedBy="question", cascade={"remove"}) */ + #[ORM\OneToMany(targetEntity: CSurveyAnswer::class, mappedBy: 'question', cascade: ['remove'])] protected Collection $answers; - /** - * @ORM\Column(name="survey_question", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'survey_question', type: 'text', nullable: false)] protected string $surveyQuestion; - /** - * @ORM\Column(name="survey_question_comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'survey_question_comment', type: 'text', nullable: false)] protected ?string $surveyQuestionComment = null; - /** - * @ORM\Column(name="type", type="string", length=250, nullable=false) - */ + #[ORM\Column(name: 'type', type: 'string', length: 250, nullable: false)] protected string $type; - /** - * @ORM\Column(name="display", type="string", length=10, nullable=false) - */ + #[ORM\Column(name: 'display', type: 'string', length: 10, nullable: false)] protected string $display; - /** - * @ORM\Column(name="sort", type="integer", nullable=false) - */ + #[ORM\Column(name: 'sort', type: 'integer', nullable: false)] protected int $sort; - /** - * @ORM\Column(name="shared_question_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'shared_question_id', type: 'integer', nullable: true)] protected ?int $sharedQuestionId = null; - /** - * @ORM\Column(name="max_value", type="integer", nullable=true) - */ + #[ORM\Column(name: 'max_value', type: 'integer', nullable: true)] protected ?int $maxValue = null; - /** - * @ORM\Column(name="survey_group_pri", type="integer", nullable=false) - */ + #[ORM\Column(name: 'survey_group_pri', type: 'integer', nullable: false)] protected int $surveyGroupPri; - /** - * @ORM\Column(name="survey_group_sec1", type="integer", nullable=false) - */ + #[ORM\Column(name: 'survey_group_sec1', type: 'integer', nullable: false)] protected int $surveyGroupSec1; - /** - * @ORM\Column(name="survey_group_sec2", type="integer", nullable=false) - */ + #[ORM\Column(name: 'survey_group_sec2', type: 'integer', nullable: false)] protected int $surveyGroupSec2; - /** - * @ORM\Column(name="is_required", type="boolean", options={"default": false}) - */ + #[ORM\Column(name: 'is_required', type: 'boolean', options: ['default' => false])] protected bool $isMandatory = false; public function __construct() @@ -343,7 +307,7 @@ class CSurveyQuestion /** * @return Collection|CSurveyQuestion[] */ - public function getChildren() + public function getChildren(): \Doctrine\Common\Collections\Collection|array { return $this->children; } @@ -351,7 +315,7 @@ class CSurveyQuestion /** * @param Collection|CSurveyQuestion[] $children */ - public function setChildren(Collection $children): self + public function setChildren(\Doctrine\Common\Collections\Collection|array $children): self { $this->children = $children; @@ -385,7 +349,7 @@ class CSurveyQuestion /** * @return CSurveyAnswer[]|Collection */ - public function getAnswers() + public function getAnswers(): array|\Doctrine\Common\Collections\Collection { return $this->answers; } @@ -393,7 +357,7 @@ class CSurveyQuestion /** * @return CSurveyQuestionOption[]|Collection */ - public function getOptions() + public function getOptions(): array|\Doctrine\Common\Collections\Collection { return $this->options; } @@ -401,7 +365,7 @@ class CSurveyQuestion /** * @param CSurveyQuestionOption[]|Collection $options */ - public function setOptions($options): self + public function setOptions(array|\Doctrine\Common\Collections\Collection $options): self { $this->options = $options; diff --git a/src/CourseBundle/Entity/CSurveyQuestionOption.php b/src/CourseBundle/Entity/CSurveyQuestionOption.php index aab9d87119..cd65d43d92 100644 --- a/src/CourseBundle/Entity/CSurveyQuestionOption.php +++ b/src/CourseBundle/Entity/CSurveyQuestionOption.php @@ -8,49 +8,31 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_survey_question_option", - * indexes={ - * @ORM\Index(name="idx_survey_qo_qid", columns={"question_id"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_survey_question_option')] +#[ORM\Index(name: 'idx_survey_qo_qid', columns: ['question_id'])] +#[ORM\Entity] class CSurveyQuestionOption { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", inversedBy="options") - * @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CSurveyQuestion::class, inversedBy: 'options')] + #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CSurveyQuestion $question; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurvey", inversedBy="options") - * @ORM\JoinColumn(name="survey_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CSurvey::class, inversedBy: 'options')] + #[ORM\JoinColumn(name: 'survey_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CSurvey $survey; - /** - * @ORM\Column(name="option_text", type="text", nullable=false) - */ + #[ORM\Column(name: 'option_text', type: 'text', nullable: false)] protected string $optionText; - /** - * @ORM\Column(name="sort", type="integer", nullable=false) - */ + #[ORM\Column(name: 'sort', type: 'integer', nullable: false)] protected int $sort; - /** - * @ORM\Column(name="value", type="integer", nullable=false) - */ + #[ORM\Column(name: 'value', type: 'integer', nullable: false)] protected int $value; public function __construct() diff --git a/src/CourseBundle/Entity/CThematic.php b/src/CourseBundle/Entity/CThematic.php index 8263c13641..7a01ca4e5e 100644 --- a/src/CourseBundle/Entity/CThematic.php +++ b/src/CourseBundle/Entity/CThematic.php @@ -13,63 +13,42 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_thematic", - * indexes={ - * @ORM\Index(name="active", columns={"active"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CThematicRepository") - */ -class CThematic extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_thematic')] +#[ORM\Index(name: 'active', columns: ['active'])] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CThematicRepository::class)] +class CThematic extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'text', nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="display_order", type="integer", nullable=false) - */ + #[ORM\Column(name: 'display_order', type: 'integer', nullable: false)] protected int $displayOrder; - /** - * @ORM\Column(name="active", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'active', type: 'boolean', nullable: false)] protected bool $active; /** * @var Collection|CThematicPlan[] - * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CThematicPlan", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CThematicPlan::class, mappedBy: 'thematic', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $plans; /** * @var Collection|CThematicAdvance[] * - * @ORM\OrderBy({"startDate" = "ASC"}) * - * @ORM\OneToMany( - * targetEntity="Chamilo\CourseBundle\Entity\CThematicAdvance", mappedBy="thematic", cascade={"persist", "remove"}, orphanRemoval=true - * ) */ + #[ORM\OrderBy(['startDate' => 'ASC'])] + #[ORM\OneToMany(targetEntity: \Chamilo\CourseBundle\Entity\CThematicAdvance::class, mappedBy: 'thematic', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $advances; public function __construct() @@ -156,7 +135,7 @@ class CThematic extends AbstractResource implements ResourceInterface /** * @return Collection|CThematicPlan[] */ - public function getPlans() + public function getPlans(): \Doctrine\Common\Collections\Collection|array { return $this->plans; } @@ -164,7 +143,7 @@ class CThematic extends AbstractResource implements ResourceInterface /** * @return Collection|CThematicAdvance[] */ - public function getAdvances() + public function getAdvances(): \Doctrine\Common\Collections\Collection|array { return $this->advances; } diff --git a/src/CourseBundle/Entity/CThematicAdvance.php b/src/CourseBundle/Entity/CThematicAdvance.php index 3b511cd230..e67f8d63bf 100644 --- a/src/CourseBundle/Entity/CThematicAdvance.php +++ b/src/CourseBundle/Entity/CThematicAdvance.php @@ -12,59 +12,37 @@ use Chamilo\CoreBundle\Entity\Room; use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_thematic_advance", - * indexes={ - * } - * ) - * @ORM\Entity - */ -class CThematicAdvance //extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_thematic_advance')] +#[ORM\Entity] +class CThematicAdvance implements \Stringable //extends AbstractResource implements ResourceInterface { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CThematic", inversedBy="advances") - * @ORM\JoinColumn(name="thematic_id", referencedColumnName="iid") - */ + #[ORM\ManyToOne(targetEntity: CThematic::class, inversedBy: 'advances')] + #[ORM\JoinColumn(name: 'thematic_id', referencedColumnName: 'iid')] protected CThematic $thematic; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendance") - * @ORM\JoinColumn(name="attendance_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CAttendance::class)] + #[ORM\JoinColumn(name: 'attendance_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CAttendance $attendance; - /** - * @ORM\Column(name="content", type="text", nullable=true) - */ + #[ORM\Column(name: 'content', type: 'text', nullable: true)] protected ?string $content = null; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: false)] protected DateTime $startDate; - /** - * @ORM\Column(name="duration", type="integer", nullable=false) - */ + #[ORM\Column(name: 'duration', type: 'integer', nullable: false)] protected int $duration; - /** - * @ORM\Column(name="done_advance", type="boolean", nullable=false) - */ + #[ORM\Column(name: 'done_advance', type: 'boolean', nullable: false)] protected bool $doneAdvance; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Room") - * @ORM\JoinColumn(name="room_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Room::class)] + #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')] protected ?Room $room = null; public function __construct() diff --git a/src/CourseBundle/Entity/CThematicPlan.php b/src/CourseBundle/Entity/CThematicPlan.php index 88a9f08e70..90d9dc322f 100644 --- a/src/CourseBundle/Entity/CThematicPlan.php +++ b/src/CourseBundle/Entity/CThematicPlan.php @@ -11,44 +11,28 @@ use Chamilo\CoreBundle\Entity\ResourceInterface; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_thematic_plan", - * indexes={ - * @ORM\Index(name="thematic_id", columns={"thematic_id", "description_type"}) - * } - * ) - * @ORM\Entity - */ -class CThematicPlan //extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_thematic_plan')] +#[ORM\Index(name: 'thematic_id', columns: ['thematic_id', 'description_type'])] +#[ORM\Entity] +class CThematicPlan implements \Stringable //extends AbstractResource implements ResourceInterface { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CThematic", inversedBy="plans") - * @ORM\JoinColumn(name="thematic_id", referencedColumnName="iid", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: CThematic::class, inversedBy: 'plans')] + #[ORM\JoinColumn(name: 'thematic_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] protected CThematic $thematic; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description = null; - /** - * @ORM\Column(name="description_type", type="integer", nullable=false) - */ + #[ORM\Column(name: 'description_type', type: 'integer', nullable: false)] protected int $descriptionType; public function __toString(): string diff --git a/src/CourseBundle/Entity/CTool.php b/src/CourseBundle/Entity/CTool.php index a850adcae6..f503f6d25a 100644 --- a/src/CourseBundle/Entity/CTool.php +++ b/src/CourseBundle/Entity/CTool.php @@ -13,22 +13,12 @@ use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Tool; +use Chamilo\CourseBundle\Repository\CToolRepository; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\HasLifecycleCallbacks - * @ORM\Table( - * name="c_tool", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CToolRepository") - */ #[ApiResource( attributes: [ 'security' => "is_granted('ROLE_ADMIN') or is_granted('ROLE_CURRENT_COURSE_TEACHER')", @@ -40,51 +30,42 @@ use Symfony\Component\Validator\Constraints as Assert; 'groups' => ['ctool:read'], ], )] -class CTool extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_tool')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\HasLifecycleCallbacks] +#[ORM\Entity(repositoryClass: CToolRepository::class)] +class CTool extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['ctool:read'])] + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $iid = null; - /** - * @ORM\Column(name="name", type="text", nullable=false) - */ #[Assert\NotBlank] #[Groups(['ctool:read'])] + #[ORM\Column(name: 'name', type: 'text', nullable: false)] protected string $name; - /** - * @ORM\Column(name="visibility", type="boolean", nullable=true) - */ #[Groups(['ctool:read'])] + #[ORM\Column(name: 'visibility', type: 'boolean', nullable: true)] protected ?bool $visibility = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="tools") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'tools')] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false)] protected Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") - * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: Session::class)] + #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Session $session = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tool") - * @ORM\JoinColumn(name="tool_id", referencedColumnName="id", nullable=false) - */ + #[ORM\ManyToOne(targetEntity: Tool::class)] + #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id', nullable: false)] protected Tool $tool; - /** - * @Gedmo\SortablePosition - * @ORM\Column(name="position", type="integer") - */ + #[Gedmo\SortablePosition] + #[ORM\Column(name: 'position', type: 'integer')] protected int $position; #[Groups(['ctool:read'])] diff --git a/src/CourseBundle/Entity/CToolIntro.php b/src/CourseBundle/Entity/CToolIntro.php index 4d6bea1cd1..3c1e2d4115 100644 --- a/src/CourseBundle/Entity/CToolIntro.php +++ b/src/CourseBundle/Entity/CToolIntro.php @@ -16,14 +16,6 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="c_tool_intro", - * indexes={ - * } - * ) - * @ORM\Entity - */ #[ApiResource( collectionOperations: [ 'get' => [ @@ -59,29 +51,25 @@ use Symfony\Component\Validator\Constraints as Assert; #[ApiFilter(SearchFilter::class, properties: [ 'courseTool' => 'exact', ])] -class CToolIntro extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface +#[ORM\Table(name: 'c_tool_intro')] +#[ORM\Entity] +class CToolIntro extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ #[Groups(['c_tool_intro:read'])] + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="intro_text", type="text", nullable=false) - */ #[Assert\NotNull] #[Groups(['c_tool_intro:read', 'c_tool_intro:write'])] + #[ORM\Column(name: 'intro_text', type: 'text', nullable: false)] protected string $introText; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CTool") - * @ORM\JoinColumn(name="c_tool_id", referencedColumnName="iid", nullable=false, onDelete="CASCADE") - */ #[Assert\NotNull] #[Groups(['c_tool_intro:read', 'c_tool_intro:write'])] + #[ORM\ManyToOne(targetEntity: CTool::class)] + #[ORM\JoinColumn(name: 'c_tool_id', referencedColumnName: 'iid', nullable: false, onDelete: 'CASCADE')] protected CTool $courseTool; public function __toString(): string diff --git a/src/CourseBundle/Entity/CWiki.php b/src/CourseBundle/Entity/CWiki.php index fd1f00eb5f..87f7ab42e4 100644 --- a/src/CourseBundle/Entity/CWiki.php +++ b/src/CourseBundle/Entity/CWiki.php @@ -14,159 +14,99 @@ use Symfony\Component\Validator\Constraints as Assert; /** * CWiki. - * - * @ORM\Table( - * name="c_wiki", - * options={"row_format":"DYNAMIC"}, - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="reflink", columns={"reflink"}), - * @ORM\Index(name="group_id", columns={"group_id"}), - * @ORM\Index(name="page_id", columns={"page_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) - * } - * ) - * @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CWikiRepository") */ -class CWiki extends AbstractResource implements ResourceInterface +#[ORM\Table(name: 'c_wiki', options: ['row_format' => 'DYNAMIC'])] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'reflink', columns: ['reflink'])] +#[ORM\Index(name: 'group_id', columns: ['group_id'])] +#[ORM\Index(name: 'page_id', columns: ['page_id'])] +#[ORM\Index(name: 'session_id', columns: ['session_id'])] +#[ORM\Entity(repositoryClass: \Chamilo\CourseBundle\Repository\CWikiRepository::class)] +class CWiki extends AbstractResource implements ResourceInterface, \Stringable { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="page_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'page_id', type: 'integer', nullable: true)] protected ?int $pageId = null; - /** - * @ORM\Column(name="reflink", type="string", length=255, nullable=false) - */ + #[ORM\Column(name: 'reflink', type: 'string', length: 255, nullable: false)] protected string $reflink; - /** - * @ORM\Column(name="title", type="string", length=255, nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)] protected string $title; - /** - * @ORM\Column(name="content", type="text", nullable=false) - */ #[Assert\NotBlank] + #[ORM\Column(name: 'content', type: 'text', nullable: false)] protected string $content; - /** - * @ORM\Column(name="user_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'user_id', type: 'integer', nullable: false)] protected int $userId; - /** - * @ORM\Column(name="group_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'group_id', type: 'integer', nullable: true)] protected ?int $groupId = null; - /** - * @ORM\Column(name="dtime", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'dtime', type: 'datetime', nullable: true)] protected ?DateTime $dtime = null; - /** - * @ORM\Column(name="addlock", type="integer", nullable=false) - */ + #[ORM\Column(name: 'addlock', type: 'integer', nullable: false)] protected int $addlock; - /** - * @ORM\Column(name="editlock", type="integer", nullable=false) - */ + #[ORM\Column(name: 'editlock', type: 'integer', nullable: false)] protected int $editlock; - /** - * @ORM\Column(name="visibility", type="integer", nullable=false) - */ + #[ORM\Column(name: 'visibility', type: 'integer', nullable: false)] protected int $visibility; - /** - * @ORM\Column(name="addlock_disc", type="integer", nullable=false) - */ + #[ORM\Column(name: 'addlock_disc', type: 'integer', nullable: false)] protected int $addlockDisc; - /** - * @ORM\Column(name="visibility_disc", type="integer", nullable=false) - */ + #[ORM\Column(name: 'visibility_disc', type: 'integer', nullable: false)] protected int $visibilityDisc; - /** - * @ORM\Column(name="ratinglock_disc", type="integer", nullable=false) - */ + #[ORM\Column(name: 'ratinglock_disc', type: 'integer', nullable: false)] protected int $ratinglockDisc; - /** - * @ORM\Column(name="assignment", type="integer", nullable=false) - */ + #[ORM\Column(name: 'assignment', type: 'integer', nullable: false)] protected int $assignment; - /** - * @ORM\Column(name="comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: false)] protected string $comment; - /** - * @ORM\Column(name="progress", type="text", nullable=false) - */ + #[ORM\Column(name: 'progress', type: 'text', nullable: false)] protected string $progress; - /** - * @ORM\Column(name="score", type="integer", nullable=true) - */ + #[ORM\Column(name: 'score', type: 'integer', nullable: true)] protected ?int $score = null; - /** - * @ORM\Column(name="version", type="integer", nullable=true) - */ + #[ORM\Column(name: 'version', type: 'integer', nullable: true)] protected ?int $version = null; - /** - * @ORM\Column(name="is_editing", type="integer", nullable=false) - */ + #[ORM\Column(name: 'is_editing', type: 'integer', nullable: false)] protected int $isEditing; - /** - * @ORM\Column(name="time_edit", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'time_edit', type: 'datetime', nullable: true)] protected ?DateTime $timeEdit = null; - /** - * @ORM\Column(name="hits", type="integer", nullable=true) - */ + #[ORM\Column(name: 'hits', type: 'integer', nullable: true)] protected ?int $hits = null; - /** - * @ORM\Column(name="linksto", type="text", nullable=false) - */ + #[ORM\Column(name: 'linksto', type: 'text', nullable: false)] protected string $linksto; - /** - * @ORM\Column(name="tag", type="text", nullable=false) - */ + #[ORM\Column(name: 'tag', type: 'text', nullable: false)] protected string $tag; - /** - * @ORM\Column(name="user_ip", type="string", length=45, nullable=false) - */ + #[ORM\Column(name: 'user_ip', type: 'string', length: 45, nullable: false)] protected string $userIp; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; public function __toString(): string diff --git a/src/CourseBundle/Entity/CWikiConf.php b/src/CourseBundle/Entity/CWikiConf.php index c6f1635ca0..7611374642 100644 --- a/src/CourseBundle/Entity/CWikiConf.php +++ b/src/CourseBundle/Entity/CWikiConf.php @@ -11,98 +11,61 @@ use Doctrine\ORM\Mapping as ORM; /** * CWikiConf. - * - * @ORM\Table( - * name="c_wiki_conf", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="page_id", columns={"page_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_wiki_conf')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'page_id', columns: ['page_id'])] +#[ORM\Entity] class CWikiConf { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="page_id", type="integer") - */ + #[ORM\Column(name: 'page_id', type: 'integer')] protected int $pageId; - /** - * @ORM\Column(name="task", type="text", nullable=false) - */ + #[ORM\Column(name: 'task', type: 'text', nullable: false)] protected string $task; - /** - * @ORM\Column(name="feedback1", type="text", nullable=false) - */ + #[ORM\Column(name: 'feedback1', type: 'text', nullable: false)] protected string $feedback1; - /** - * @ORM\Column(name="feedback2", type="text", nullable=false) - */ + #[ORM\Column(name: 'feedback2', type: 'text', nullable: false)] protected string $feedback2; - /** - * @ORM\Column(name="feedback3", type="text", nullable=false) - */ + #[ORM\Column(name: 'feedback3', type: 'text', nullable: false)] protected string $feedback3; - /** - * @ORM\Column(name="fprogress1", type="string", length=3, nullable=false) - */ + #[ORM\Column(name: 'fprogress1', type: 'string', length: 3, nullable: false)] protected string $fprogress1; - /** - * @ORM\Column(name="fprogress2", type="string", length=3, nullable=false) - */ + #[ORM\Column(name: 'fprogress2', type: 'string', length: 3, nullable: false)] protected string $fprogress2; - /** - * @ORM\Column(name="fprogress3", type="string", length=3, nullable=false) - */ + #[ORM\Column(name: 'fprogress3', type: 'string', length: 3, nullable: false)] protected string $fprogress3; - /** - * @ORM\Column(name="max_size", type="integer", nullable=true) - */ + #[ORM\Column(name: 'max_size', type: 'integer', nullable: true)] protected ?int $maxSize = null; - /** - * @ORM\Column(name="max_text", type="integer", nullable=true) - */ + #[ORM\Column(name: 'max_text', type: 'integer', nullable: true)] protected ?int $maxText = null; - /** - * @ORM\Column(name="max_version", type="integer", nullable=true) - */ + #[ORM\Column(name: 'max_version', type: 'integer', nullable: true)] protected ?int $maxVersion = null; - /** - * @ORM\Column(name="startdate_assig", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'startdate_assig', type: 'datetime', nullable: true)] protected ?DateTime $startdateAssig = null; - /** - * @ORM\Column(name="enddate_assig", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'enddate_assig', type: 'datetime', nullable: true)] protected ?DateTime $enddateAssig = null; - /** - * @ORM\Column(name="delayedsubmit", type="integer", nullable=false) - */ + #[ORM\Column(name: 'delayedsubmit', type: 'integer', nullable: false)] protected int $delayedsubmit; /** diff --git a/src/CourseBundle/Entity/CWikiDiscuss.php b/src/CourseBundle/Entity/CWikiDiscuss.php index 4e816d46c6..e195f97f49 100644 --- a/src/CourseBundle/Entity/CWikiDiscuss.php +++ b/src/CourseBundle/Entity/CWikiDiscuss.php @@ -11,52 +11,33 @@ use Doctrine\ORM\Mapping as ORM; /** * CWikiDiscuss. - * - * @ORM\Table( - * name="c_wiki_discuss", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) - * } - * ) - * @ORM\Entity */ +#[ORM\Table(name: 'c_wiki_discuss')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Entity] class CWikiDiscuss { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="publication_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'publication_id', type: 'integer', nullable: false)] protected int $publicationId; - /** - * @ORM\Column(name="userc_id", type="integer", nullable=false) - */ + #[ORM\Column(name: 'userc_id', type: 'integer', nullable: false)] protected int $usercId; - /** - * @ORM\Column(name="comment", type="text", nullable=false) - */ + #[ORM\Column(name: 'comment', type: 'text', nullable: false)] protected string $comment; - /** - * @ORM\Column(name="p_score", type="string", length=255, nullable=true) - */ + #[ORM\Column(name: 'p_score', type: 'string', length: 255, nullable: true)] protected ?string $pScore = null; - /** - * @ORM\Column(name="dtime", type="datetime", nullable=false) - */ + #[ORM\Column(name: 'dtime', type: 'datetime', nullable: false)] protected DateTime $dtime; /** diff --git a/src/CourseBundle/Entity/CWikiMailcue.php b/src/CourseBundle/Entity/CWikiMailcue.php index b54c90987e..5e62f6cb55 100644 --- a/src/CourseBundle/Entity/CWikiMailcue.php +++ b/src/CourseBundle/Entity/CWikiMailcue.php @@ -8,49 +8,31 @@ namespace Chamilo\CourseBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table( - * name="c_wiki_mailcue", - * indexes={ - * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="user", columns={"user_id"}), - * @ORM\Index(name="c_id", columns={"c_id", "iid"}) - * } - * ) - * @ORM\Entity - */ +#[ORM\Table(name: 'c_wiki_mailcue')] +#[ORM\Index(name: 'course', columns: ['c_id'])] +#[ORM\Index(name: 'user', columns: ['user_id'])] +#[ORM\Index(name: 'c_id', columns: ['c_id', 'iid'])] +#[ORM\Entity] class CWikiMailcue { - /** - * @ORM\Column(name="iid", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'iid', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected int $iid; - /** - * @ORM\Column(name="c_id", type="integer") - */ + #[ORM\Column(name: 'c_id', type: 'integer')] protected int $cId; - /** - * @ORM\Column(name="type", type="text", nullable=false) - */ + #[ORM\Column(name: 'type', type: 'text', nullable: false)] protected string $type; - /** - * @ORM\Column(name="group_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'group_id', type: 'integer', nullable: true)] protected ?int $groupId = null; - /** - * @ORM\Column(name="session_id", type="integer", nullable=true) - */ + #[ORM\Column(name: 'session_id', type: 'integer', nullable: true)] protected ?int $sessionId = null; - /** - * @ORM\Column(name="user_id", type="integer") - */ + #[ORM\Column(name: 'user_id', type: 'integer')] protected int $userId; /** diff --git a/src/LtiBundle/Entity/ExternalTool.php b/src/LtiBundle/Entity/ExternalTool.php index 537d5f77d5..8bc83feb9b 100644 --- a/src/LtiBundle/Entity/ExternalTool.php +++ b/src/LtiBundle/Entity/ExternalTool.php @@ -19,121 +19,78 @@ use UnserializeApi; /** * Class ExternalTool. - * - * @ORM\Table(name="lti_external_tool") - * @ORM\Entity */ -class ExternalTool extends AbstractResource implements ResourceInterface, ResourceToRootInterface +#[ORM\Table(name: 'lti_external_tool')] +#[ORM\Entity] +class ExternalTool extends AbstractResource implements ResourceInterface, ResourceToRootInterface, \Stringable { public const V_1P1 = 'lti1p1'; public const V_1P3 = 'lti1p3'; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="name", type="string") - */ + #[ORM\Column(name: 'name', type: 'string')] protected string $name; - /** - * @ORM\Column(name="description", type="text", nullable=true) - */ + #[ORM\Column(name: 'description', type: 'text', nullable: true)] protected ?string $description; - /** - * @ORM\Column(name="launch_url", type="string") - */ + #[ORM\Column(name: 'launch_url', type: 'string')] protected string $launchUrl; - /** - * @ORM\Column(name="consumer_key", type="string", nullable=true) - */ + #[ORM\Column(name: 'consumer_key', type: 'string', nullable: true)] protected ?string $consumerKey; - /** - * @ORM\Column(name="shared_secret", type="string", nullable=true) - */ + #[ORM\Column(name: 'shared_secret', type: 'string', nullable: true)] protected ?string $sharedSecret; - /** - * @ORM\Column(name="custom_params", type="text", nullable=true) - */ + #[ORM\Column(name: 'custom_params', type: 'text', nullable: true)] protected ?string $customParams; - /** - * @ORM\Column(name="active_deep_linking", type="boolean", nullable=false, options={"default": false}) - */ + #[ORM\Column(name: 'active_deep_linking', type: 'boolean', nullable: false, options: ['default' => false])] protected bool $activeDeepLinking; - /** - * @ORM\Column(name="privacy", type="text", nullable=true, options={"default": null}) - */ + #[ORM\Column(name: 'privacy', type: 'text', nullable: true, options: ['default' => null])] protected ?string $privacy; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") - * @ORM\JoinColumn(name="c_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: Course::class)] + #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id')] protected ?Course $course; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation") - * @ORM\JoinColumn(name="gradebook_eval_id", referencedColumnName="id", onDelete="SET NULL") - */ + #[ORM\ManyToOne(targetEntity: GradebookEvaluation::class)] + #[ORM\JoinColumn(name: 'gradebook_eval_id', referencedColumnName: 'id', onDelete: 'SET NULL')] protected ?GradebookEvaluation $gradebookEval; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\LtiBundle\Entity\ExternalTool", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: ExternalTool::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id')] protected ?ExternalTool $parent; - /** - * @ORM\OneToMany(targetEntity="Chamilo\LtiBundle\Entity\ExternalTool", mappedBy="parent") - */ + #[ORM\OneToMany(targetEntity: ExternalTool::class, mappedBy: 'parent')] protected Collection $children; - /** - * @ORM\Column(name="client_id", type="string", nullable=true) - */ - private ?string $clientId; - /** - * @ORM\Column(name="login_url", type="string", nullable=true) - */ - private ?string $loginUrl; - - /** - * @ORM\Column(name="redirect_url", type="string", nullable=true) - */ - private ?string $redirectUrl; - - /** - * @ORM\Column(name="advantage_services", type="json", nullable=true) - */ + #[ORM\Column(name: 'client_id', type: 'string', nullable: true)] + private ?string $clientId = null; + #[ORM\Column(name: 'login_url', type: 'string', nullable: true)] + private ?string $loginUrl = null; + + #[ORM\Column(name: 'redirect_url', type: 'string', nullable: true)] + private ?string $redirectUrl = null; + + #[ORM\Column(name: 'advantage_services', type: 'json', nullable: true)] private ?array $advantageServices; - /** - * @ORM\OneToMany(targetEntity="Chamilo\LtiBundle\Entity\LineItem", mappedBy="tool") - */ + #[ORM\OneToMany(targetEntity: LineItem::class, mappedBy: 'tool')] private Collection $lineItems; - /** - * @ORM\Column(name="version", type="string", options={"default": "lti1p1"}) - */ + #[ORM\Column(name: 'version', type: 'string', options: ['default' => 'lti1p1'])] private string $version; - /** - * @ORM\Column(name="launch_presentation", type="json") - */ + #[ORM\Column(name: 'launch_presentation', type: 'json')] private array $launchPresentation; - /** - * @ORM\Column(name="replacement_params", type="json") - */ + #[ORM\Column(name: 'replacement_params', type: 'json')] private array $replacementParams; public function __construct() @@ -580,9 +537,7 @@ class ExternalTool extends AbstractResource implements ResourceInterface, Resour public function getChildrenInCourses(array $coursesId): Collection { return $this->children->filter( - function (self $child) use ($coursesId) { - return \in_array($child->getCourse()->getId(), $coursesId, true); - } + fn(self $child) => \in_array($child->getCourse()->getId(), $coursesId, true) ); } diff --git a/src/LtiBundle/Entity/LineItem.php b/src/LtiBundle/Entity/LineItem.php index a6f0f04046..95e399efa5 100644 --- a/src/LtiBundle/Entity/LineItem.php +++ b/src/LtiBundle/Entity/LineItem.php @@ -13,43 +13,28 @@ use Doctrine\ORM\Mapping as ORM; /** * Class LineItem. - * - * @ORM\Table(name="lti_lineitem") - * @ORM\Entity */ +#[ORM\Table(name: 'lti_lineitem')] +#[ORM\Entity] class LineItem { - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\LtiBundle\Entity\ExternalTool", inversedBy="lineItems") - * @ORM\JoinColumn(name="tool_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: ExternalTool::class, inversedBy: 'lineItems')] + #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] private ExternalTool $tool; - /** - * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation") - * @ORM\JoinColumn(name="evaluation", referencedColumnName="id", nullable=false, onDelete="CASCADE") - */ + #[ORM\OneToOne(targetEntity: GradebookEvaluation::class)] + #[ORM\JoinColumn(name: 'evaluation', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] private GradebookEvaluation $evaluation; - /** - * @ORM\Column(name="resource_id", type="string", nullable=true) - */ + #[ORM\Column(name: 'resource_id', type: 'string', nullable: true)] private string $resourceId; - /** - * @ORM\Column(name="tag", type="string", nullable=true) - */ + #[ORM\Column(name: 'tag', type: 'string', nullable: true)] private string $tag; - /** - * @ORM\Column(name="start_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)] private DateTime $startDate; - /** - * @ORM\Column(name="end_date", type="datetime", nullable=true) - */ + #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)] private DateTime $endDate; public function getId(): int diff --git a/src/LtiBundle/Entity/Platform.php b/src/LtiBundle/Entity/Platform.php index 963e954d60..af024b5688 100644 --- a/src/LtiBundle/Entity/Platform.php +++ b/src/LtiBundle/Entity/Platform.php @@ -10,29 +10,20 @@ use Doctrine\ORM\Mapping as ORM; /** * Class Platform. - * - * @ORM\Table(name="lti_platform") - * @ORM\Entity() */ +#[ORM\Table(name: 'lti_platform')] +#[ORM\Entity] class Platform { - /** - * @ORM\Column(name="public_key", type="text") - */ + #[ORM\Column(name: 'public_key', type: 'text')] public string $publicKey; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id() - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\Column(name="kid", type="string") - */ + #[ORM\Column(name: 'kid', type: 'string')] private string $kid; - /** - * @ORM\Column(name="private_key", type="text") - */ + #[ORM\Column(name: 'private_key', type: 'text')] private string $privateKey; public function getId(): int diff --git a/src/LtiBundle/Entity/Token.php b/src/LtiBundle/Entity/Token.php index a588972ab8..98195bd221 100644 --- a/src/LtiBundle/Entity/Token.php +++ b/src/LtiBundle/Entity/Token.php @@ -10,40 +10,27 @@ use Doctrine\ORM\Mapping as ORM; /** * Class Token. - * - * @ORM\Table(name="lti_token") - * @ORM\Entity */ +#[ORM\Table(name: 'lti_token')] +#[ORM\Entity] class Token { public const TOKEN_LIFETIME = 3600; - /** - * @ORM\Column(name="id", type="integer") - * @ORM\Id() - * @ORM\GeneratedValue() - */ + #[ORM\Column(name: 'id', type: 'integer')] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chamilo\LtiBundle\Entity\ExternalTool") - * @ORM\JoinColumn(name="tool_id", referencedColumnName="id", onDelete="CASCADE") - */ + #[ORM\ManyToOne(targetEntity: ExternalTool::class)] + #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id', onDelete: 'CASCADE')] private ExternalTool $tool; - /** - * @ORM\Column(name="scope", type="json") - */ + #[ORM\Column(name: 'scope', type: 'json')] private array $scope; - /** - * @ORM\Column(name="hash", type="string") - */ + #[ORM\Column(name: 'hash', type: 'string')] private string $hash; - /** - * @ORM\Column(name="created_at", type="integer") - */ + #[ORM\Column(name: 'created_at', type: 'integer')] private int $createdAt; - /** - * @ORM\Column(name="expires_at", type="integer") - */ + #[ORM\Column(name: 'expires_at', type: 'integer')] private int $expiresAt; public function getId(): int @@ -118,7 +105,7 @@ class Token public function generateHash(): static { - $this->hash = sha1(uniqid((string) mt_rand())); + $this->hash = sha1(uniqid((string) random_int(0, mt_getrandmax()))); return $this; }