Skip to content

Commit 46b6ee9

Browse files
committed
Create Review entity
1 parent d439656 commit 46b6ee9

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

src/Entity/Review.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace App\Entity;
4+
5+
use Doctrine\ORM\Mapping as ORM;
6+
7+
/**
8+
* @ORM\Entity(repositoryClass="App\Repository\ReviewRepository")
9+
*/
10+
class Review
11+
{
12+
/**
13+
* @ORM\Id()
14+
* @ORM\GeneratedValue()
15+
* @ORM\Column(type="integer")
16+
*/
17+
private $id;
18+
19+
/**
20+
* @ORM\Column(type="text", nullable=true)
21+
*/
22+
private $message;
23+
24+
/**
25+
* @ORM\Column(type="integer")
26+
*/
27+
private $rating;
28+
29+
public function getId(): ?int
30+
{
31+
return $this->id;
32+
}
33+
34+
public function getMessage(): ?string
35+
{
36+
return $this->message;
37+
}
38+
39+
public function setMessage(?string $message): self
40+
{
41+
$this->message = $message;
42+
43+
return $this;
44+
}
45+
46+
public function getRating(): ?int
47+
{
48+
return $this->rating;
49+
}
50+
51+
public function setRating(int $rating): self
52+
{
53+
$this->rating = $rating;
54+
55+
return $this;
56+
}
57+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Repository;
4+
5+
use App\Entity\Review;
6+
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7+
use Doctrine\Common\Persistence\ManagerRegistry;
8+
9+
/**
10+
* @method Review|null find($id, $lockMode = null, $lockVersion = null)
11+
* @method Review|null findOneBy(array $criteria, array $orderBy = null)
12+
* @method Review[] findAll()
13+
* @method Review[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
14+
*/
15+
class ReviewRepository extends ServiceEntityRepository
16+
{
17+
public function __construct(ManagerRegistry $registry)
18+
{
19+
parent::__construct($registry, Review::class);
20+
}
21+
22+
// /**
23+
// * @return Review[] Returns an array of Review objects
24+
// */
25+
/*
26+
public function findByExampleField($value)
27+
{
28+
return $this->createQueryBuilder('r')
29+
->andWhere('r.exampleField = :val')
30+
->setParameter('val', $value)
31+
->orderBy('r.id', 'ASC')
32+
->setMaxResults(10)
33+
->getQuery()
34+
->getResult()
35+
;
36+
}
37+
*/
38+
39+
/*
40+
public function findOneBySomeField($value): ?Review
41+
{
42+
return $this->createQueryBuilder('r')
43+
->andWhere('r.exampleField = :val')
44+
->setParameter('val', $value)
45+
->getQuery()
46+
->getOneOrNullResult()
47+
;
48+
}
49+
*/
50+
}

0 commit comments

Comments
 (0)