Skip to content

Commit

Permalink
Fixed many deprecations seen from symfony/php upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dmols committed Jan 8, 2025
1 parent f6eaa23 commit 796f4d5
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 354 deletions.
59 changes: 17 additions & 42 deletions src/Entity/ContentItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,48 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="App\Repository\ContentItemRepository")
*/
#[ORM\Entity(repositoryClass: "App\Repository\ContentItemRepository")]
class ContentItem implements \JsonSerializable
{
// Private Members
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/

#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type="integer")]
private $id;

/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $title;

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Course", inversedBy="contentItems")
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: "App\Entity\Course", inversedBy: "contentItems")]
#[ORM\JoinColumn(nullable=false)]
private $course;

/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $contentType;

/**
* @ORM\Column(type="string", length=512)
*/
#[ORM\Column(type: "string", length: 512)]
private $lmsContentId;

/**
* @ORM\Column(type="datetime")
*/
#[ORM\Column(type: "datetime")]
private $updated;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: "text", nullable: true)]
private $metadata;

/**
* @ORM\OneToMany(targetEntity="App\Entity\Issue", mappedBy="contentItem")
*/
#[ORM\OneToMany(targetEntity: "App\Entity\Issue", mappedBy: "contentItem")]
private $issues;

/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: "boolean")]
private $published;

/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: "boolean")]
private $active;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: "text", nullable: true)]
private $body;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $url;


Expand Down
72 changes: 24 additions & 48 deletions src/Entity/Course.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,52 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="App\Repository\CourseRepository")
*/
#[ORM\Entity(repositoryClass: "App\Repository\CourseRepository")]
class Course implements \JsonSerializable
{
// Private Members
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type="integer")]
private $id;

/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $title;

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Institution", inversedBy="courses")
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: "App\Entity\Institution", inversedBy: "courses")]
#[ORM\JoinColumn(nullable: false)]
private $institution;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/

#[ORM\Column(type: "string", length: 255, nullable: true)]
private $lmsAccountId;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $lmsCourseId;

/**
* @ORM\Column(type="datetime", nullable=true)
*/

#[ORM\Column(type: "datetime", nullable: true)]
private $lastUpdated;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[ORM\Column(type: "boolean", nullable: true)]
private $active;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[ORM\Column(type: "boolean", nullable: true)]
private $dirty;

/**
* @ORM\OneToMany(targetEntity="App\Entity\ContentItem", mappedBy="course", orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: "App\Entity\ContentItem", mappedBy: "course", orphanRemoval: true)]

private $contentItems;

/**
* @ORM\OneToMany(targetEntity="App\Entity\Report", mappedBy="course", orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: "App\Entity\Report", mappedBy: "course", orphanRemoval: true)]
private $reports;

/**
* @ORM\OneToMany(targetEntity=FileItem::class, mappedBy="course")
*/
#[ORM\OneToMany(targetEntity: FileItem::class, mappedBy: "course")]
private $fileItems;

/**
* @ORM\Column(type="integer", nullable=true)
*/
#[ORM\Column(type: "integer", nullable: true)]
private $lmsTermId;


// Constructor
public function __construct()
{
Expand Down Expand Up @@ -260,7 +236,7 @@ public function removeReport(Report $report): self
}

public function removeAllReports(): self
{
{
$this->reports->clear();
return $this;
}
Expand All @@ -269,10 +245,10 @@ public function getPreviousReport(): ?Report
{
$reports = $this->reports->toArray();
$count = count($reports);

return ($count > 1) ? $reports[$count-2] : null;
}

public function getLatestReport(): ?Report
{
return $this->reports->last() ?: null;
Expand Down Expand Up @@ -314,7 +290,7 @@ public function getUpdatedReport()
$report->setContentFixed($fixed);
$report->setContentResolved($resolved);
$report->setFilesReviewed($filesReviewed);

return $report;
}

Expand Down Expand Up @@ -386,7 +362,7 @@ public function getAllIssues()
return $allIssues;
}

protected function sortContentItems(ContentItem $a, ContentItem $b)
protected function sortContentItems(ContentItem $a, ContentItem $b)
{
return (strtolower($a->getTitle()) > strtolower($b->getTitle())) ? 1 : -1;
}
Expand Down
73 changes: 20 additions & 53 deletions src/Entity/FileItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,91 +6,58 @@
use App\Services\UtilityService;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass=FileItemRepository::class)
*/

#[ORM\Entity(repositoryClass: FileItemRepository::class)]
class FileItem implements \JsonSerializable
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
private $id;

/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $fileName;

/**
* @ORM\ManyToOne(targetEntity=Course::class, inversedBy="fileItems")
*/
#[ORM\ManyToOne(targetEntity: Course::class, inversedBy: "fileItems")]
private $course;

/**
* @ORM\Column(type="string", length=32)
*/
#[ORM\Column(type: "string", length: 32)]
private $fileType;

/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $lmsFileId;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: "datetime", nullable: true)]
private $updated;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: "text", nullable: true)]
private $metadata;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[ORM\Column(type: "boolean", nullable: true)]
private $status;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $fileSize;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[ORM\Column(type: "boolean", nullable: true)]
private $hidden;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[ORM\Column(type: "boolean", nullable: true)]
private $reviewed;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $lmsUrl;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $downloadUrl;

/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
private $reviewedBy;

/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: "datetime", nullable: true)]
private $reviewedOn;

/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: "boolean")]
private $active;

public function getId(): ?int
Expand Down
Loading

0 comments on commit 796f4d5

Please sign in to comment.