mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
entity recreated + repository + migration done
This commit is contained in:
parent
7c37a5f583
commit
3bb0e470bc
@ -1,36 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Chill\DocStoreBundle\Entity\Document;
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\AccompanyingCourseDocumentRepository;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Table("chill_doc.accompanying_course_document")
|
||||
* @ORM\Entity()
|
||||
* @ORM\Entity(repositoryClass=AccompanyingCourseDocumentRepository::class)
|
||||
* @ORM\Table("chill_doc.accompanyingcourse_document")
|
||||
*/
|
||||
class AccompanyingCourseDocument extends Document
|
||||
class AccompanyingCourseDocument
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||
* @var AccompanyingPeriod
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $course;
|
||||
|
||||
/**
|
||||
* Get accompanying course
|
||||
*
|
||||
* @return \Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
*/
|
||||
public function getCourse()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCourse(): ?AccompanyingPeriod
|
||||
{
|
||||
return $this->course;
|
||||
}
|
||||
|
||||
public function setCourse($course): self
|
||||
public function setCourse(?AccompanyingPeriod $course): self
|
||||
{
|
||||
$this->course = $course;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\AccompanyingCourseDocument;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @method AccompanyingCourseDocument|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method AccompanyingCourseDocument|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method AccompanyingCourseDocument[] findAll()
|
||||
* @method AccompanyingCourseDocument[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class AccompanyingCourseDocumentRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, AccompanyingCourseDocument::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return AccompanyingCourseDocument[] Returns an array of AccompanyingCourseDocument objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->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()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20210903091534 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user