Move to Api/
This commit is contained in:
parent
64577e3529
commit
40eb1ca7a8
3 changed files with 45 additions and 11 deletions
34
migrations/Version20260604194453.php
Normal file
34
migrations/Version20260604194453.php
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20260604194453 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE rating (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, score SMALLINT DEFAULT NULL, subject_id INT NOT NULL, PRIMARY KEY (id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_D889262223EDC87 ON rating (subject_id)');
|
||||||
|
$this->addSql('ALTER TABLE rating ADD CONSTRAINT FK_D889262223EDC87 FOREIGN KEY (subject_id) REFERENCES subject (id) NOT DEFERRABLE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE rating DROP CONSTRAINT FK_D889262223EDC87');
|
||||||
|
$this->addSql('DROP TABLE rating');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,36 +16,36 @@ class Rating
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'ratings')]
|
#[ORM\ManyToOne(inversedBy: 'ratings')]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private ?Subject $subject_id = null;
|
private ?Subject $subject = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||||
private ?int $rating = null;
|
private ?int $score = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubjectId(): ?Subject
|
public function getSubject(): ?Subject
|
||||||
{
|
{
|
||||||
return $this->subject_id;
|
return $this->subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSubjectId(?Subject $subject_id): static
|
public function setSubject(?Subject $subject): static
|
||||||
{
|
{
|
||||||
$this->subject_id = $subject_id;
|
$this->subject = $subject;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRating(): ?int
|
public function getScore(): ?int
|
||||||
{
|
{
|
||||||
return $this->rating;
|
return $this->score;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRating(?int $rating): static
|
public function setScore(?int $score): static
|
||||||
{
|
{
|
||||||
$this->rating = $rating;
|
$this->score = $score;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Tests\Integration\Subject;
|
namespace App\Tests\Unit\Controller\Api;
|
||||||
|
|
||||||
use App\Entity\Restaurant;
|
use App\Entity\Restaurant;
|
||||||
use App\Factory\SubjectFactory;
|
use App\Factory\SubjectFactory;
|
||||||
Loading…
Reference in a new issue