diff --git a/migrations/Version20230209142217.php b/migrations/Version20230209142217.php index b2f3d78..e9941e4 100644 --- a/migrations/Version20230209142217.php +++ b/migrations/Version20230209142217.php @@ -8,7 +8,7 @@ use Doctrine\Migrations\AbstractMigration; /** - * PostgreSQL - Add missing defaults to IDs (to use sequences) + * PostgreSQL - Add missing defaults to IDs (to use sequences). */ final class Version20230209142217 extends AbstractMigration { @@ -59,4 +59,3 @@ public function down(Schema $schema): void $this->addSql('ALTER TABLE calendars ALTER COLUMN synctoken TYPE varchar(255);'); } } - diff --git a/src/Controller/DAVController.php b/src/Controller/DAVController.php index b2cc2aa..2b69972 100644 --- a/src/Controller/DAVController.php +++ b/src/Controller/DAVController.php @@ -173,7 +173,7 @@ private function initServer(string $authMethod, string $authRealm = User::DEFAUL } else { $pdo = $this->em->getConnection()->getWrappedConnection(); } - if (!($pdo instanceof PDO)) { + if (!($pdo instanceof \PDO)) { $pdo = $pdo->getNativeConnection(); } diff --git a/src/Entity/AddressBook.php b/src/Entity/AddressBook.php index 69191bd..993a8d1 100644 --- a/src/Entity/AddressBook.php +++ b/src/Entity/AddressBook.php @@ -10,7 +10,9 @@ /** * @ORM\Table(name="addressbooks") + * * @ORM\Entity() + * * @UniqueEntity( * fields={"principalUri", "uri"}, * errorPath="uri", @@ -21,7 +23,9 @@ class AddressBook { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; @@ -38,6 +42,7 @@ class AddressBook /** * @ORM\Column(type="string", length=255) + * * @Assert\Regex("/[0-9a-z\-]+/") */ private $uri; diff --git a/src/Entity/AddressBookChange.php b/src/Entity/AddressBookChange.php index b039e8b..7c4aaca 100644 --- a/src/Entity/AddressBookChange.php +++ b/src/Entity/AddressBookChange.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="addressbookchanges") + * * @ORM\Entity() */ class AddressBookChange { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; @@ -29,6 +32,7 @@ class AddressBookChange /** * @ORM\ManyToOne(targetEntity="App\Entity\AddressBook", inversedBy="changes") + * * @ORM\JoinColumn(name="addressbookid", nullable=false) */ private $addressBook; diff --git a/src/Entity/Calendar.php b/src/Entity/Calendar.php index 79cdbed..02d3b8a 100644 --- a/src/Entity/Calendar.php +++ b/src/Entity/Calendar.php @@ -8,6 +8,7 @@ /** * @ORM\Table(name="calendars") + * * @ORM\Entity() */ class Calendar @@ -18,7 +19,9 @@ class Calendar /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; diff --git a/src/Entity/CalendarChange.php b/src/Entity/CalendarChange.php index 628b44d..367b0ed 100644 --- a/src/Entity/CalendarChange.php +++ b/src/Entity/CalendarChange.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="calendarchanges") + * * @ORM\Entity() */ class CalendarChange { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; @@ -29,6 +32,7 @@ class CalendarChange /** * @ORM\ManyToOne(targetEntity="App\Entity\Calendar", inversedBy="changes") + * * @ORM\JoinColumn(name="calendarid", nullable=false) */ private $calendar; diff --git a/src/Entity/CalendarInstance.php b/src/Entity/CalendarInstance.php index bba8467..b107e69 100644 --- a/src/Entity/CalendarInstance.php +++ b/src/Entity/CalendarInstance.php @@ -8,7 +8,9 @@ /** * @ORM\Table(name="calendarinstances") + * * @ORM\Entity(repositoryClass="App\Repository\CalendarInstanceRepository") + * * @UniqueEntity( * fields={"principalUri", "uri"}, * errorPath="uri", @@ -28,13 +30,16 @@ class CalendarInstance /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity="App\Entity\Calendar", cascade={"persist"}) + * * @ORM\JoinColumn(name="calendarid", nullable=false) */ private $calendar; @@ -56,6 +61,7 @@ class CalendarInstance /** * @ORM\Column(type="string", length=255, nullable=true) + * * @Assert\Regex("/[0-9a-z\-]+/") */ private $uri; @@ -72,6 +78,7 @@ class CalendarInstance /** * @ORM\Column(name="calendarcolor", type="string", length=10, nullable=true) + * * @Assert\Regex("/\#[0-9A-F]{6}/") */ private $calendarColor; diff --git a/src/Entity/CalendarObject.php b/src/Entity/CalendarObject.php index 8acc22b..a72d1cf 100644 --- a/src/Entity/CalendarObject.php +++ b/src/Entity/CalendarObject.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="calendarobjects") + * * @ORM\Entity() */ class CalendarObject { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; @@ -29,6 +32,7 @@ class CalendarObject /** * @ORM\ManyToOne(targetEntity="App\Entity\Calendar", inversedBy="objects") + * * @ORM\JoinColumn(name="calendarid", nullable=false) */ private $calendar; diff --git a/src/Entity/CalendarSubscription.php b/src/Entity/CalendarSubscription.php index 0833652..5e5262b 100644 --- a/src/Entity/CalendarSubscription.php +++ b/src/Entity/CalendarSubscription.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="calendarsubscriptions") + * * @ORM\Entity() */ class CalendarSubscription { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; diff --git a/src/Entity/Card.php b/src/Entity/Card.php index ca8caa8..9e269c5 100644 --- a/src/Entity/Card.php +++ b/src/Entity/Card.php @@ -6,19 +6,23 @@ /** * @ORM\Table(name="cards") + * * @ORM\Entity() */ class Card { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity="App\Entity\AddressBook", inversedBy="cards") + * * @ORM\JoinColumn(name="addressbookid", nullable=false) */ private $addressBook; diff --git a/src/Entity/Lock.php b/src/Entity/Lock.php index b59363a..4da132c 100644 --- a/src/Entity/Lock.php +++ b/src/Entity/Lock.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="locks") + * * @ORM\Entity() */ class Lock { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; diff --git a/src/Entity/Principal.php b/src/Entity/Principal.php index 4005722..c99e132 100644 --- a/src/Entity/Principal.php +++ b/src/Entity/Principal.php @@ -10,7 +10,9 @@ /** * @ORM\Table(name="principals") + * * @ORM\Entity(repositoryClass="App\Repository\PrincipalRepository") + * * @UniqueEntity("uri") */ class Principal @@ -22,23 +24,29 @@ class Principal /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255, unique=true) + * * @Assert\NotBlank + * * @Assert\Unique */ private $uri; /** * @ORM\Column(type="string", length=255, nullable=true) + * * @Assert\Email( * message = "The email '{{ value }}' is not a valid email." * ) + * * @Assert\NotBlank */ private $email; @@ -50,21 +58,25 @@ class Principal /** * @ORM\Column(type="boolean") + * * @Assert\NotBlank */ private $isMain; /** * @ORM\Column(type="boolean") + * * @Assert\NotBlank */ private $isAdmin; /** * @ORM\ManyToMany(targetEntity="Principal") + * * @ORM\JoinTable( * name="groupmembers", * joinColumns={ + * * @ORM\JoinColumn(name="principal_id", referencedColumnName="id") * }, * inverseJoinColumns={ diff --git a/src/Entity/PropertyStorage.php b/src/Entity/PropertyStorage.php index 51e051c..0e5ba80 100644 --- a/src/Entity/PropertyStorage.php +++ b/src/Entity/PropertyStorage.php @@ -6,13 +6,16 @@ /** * @ORM\Table(name="propertystorage") + * * @ORM\Entity() */ class PropertyStorage { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; diff --git a/src/Entity/SchedulingObject.php b/src/Entity/SchedulingObject.php index ed79687..01196fc 100644 --- a/src/Entity/SchedulingObject.php +++ b/src/Entity/SchedulingObject.php @@ -7,13 +7,16 @@ /** * @ORM\Table(name="schedulingobjects") + * * @ORM\Entity() */ class SchedulingObject { /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; @@ -30,6 +33,7 @@ class SchedulingObject /** * @ORM\Column(type="string", length=255, nullable=true) + * * @Assert\Regex("/[0-9a-z\-]+/") */ private $uri; diff --git a/src/Entity/User.php b/src/Entity/User.php index 0ced8f4..ee3664b 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -8,7 +8,9 @@ /** * @ORM\Table(name="users") + * * @ORM\Entity() + * * @UniqueEntity("username") */ class User @@ -17,13 +19,16 @@ class User /** * @ORM\Id() + * * @ORM\GeneratedValue() + * * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255, unique=true) + * * @Assert\NotBlank */ private $username;