From 3bb0e470bc9131836e91d7efd6d76cb408708820 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 3 Sep 2021 11:26:04 +0200 Subject: [PATCH] entity recreated + repository + migration done --- .../Entity/AccompanyingCourseDocument.php | 38 ++++++++------ .../AccompanyingCourseDocumentRepository.php | 50 +++++++++++++++++++ .../migrations/Version20210903091534.php | 33 ++++++++++++ 3 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php create mode 100644 src/Bundle/ChillDocStoreBundle/migrations/Version20210903091534.php diff --git a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php index 9626a657d..d83b3e8e0 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php @@ -1,36 +1,44 @@ id; + } + + public function getCourse(): ?AccompanyingPeriod { return $this->course; } - public function setCourse($course): self + public function setCourse(?AccompanyingPeriod $course): self { $this->course = $course; return $this; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php new file mode 100644 index 000000000..4d6f25614 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('a') + ->andWhere('a.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('a.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?AccompanyingCourseDocument + { + return $this->createQueryBuilder('a') + ->andWhere('a.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +} diff --git a/src/Bundle/ChillDocStoreBundle/migrations/Version20210903091534.php b/src/Bundle/ChillDocStoreBundle/migrations/Version20210903091534.php new file mode 100644 index 000000000..b19c07f09 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/migrations/Version20210903091534.php @@ -0,0 +1,33 @@ +addSql('CREATE SEQUENCE chill_doc.accompanyingcourse_document_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_doc.accompanyingcourse_document (id INT NOT NULL, course_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_A45098F6591CC992 ON chill_doc.accompanyingcourse_document (course_id)'); + $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F6591CC992 FOREIGN KEY (course_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE chill_doc.accompanyingcourse_document_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_doc.accompanyingcourse_document'); + } +}