Entities
parent
a3e0c7e3d1
commit
e78e174fdb
|
@ -6,18 +6,13 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use ApiPlatform\Core\Annotation\ApiResource;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use ApiPlatform\Core\Annotation\ApiSubresource;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
|
||||
/**
|
||||
* @ApiResource()
|
||||
* @ApiResource(
|
||||
* collectionOperations={"get"={"method"="GET"}},
|
||||
* itemOperations={"get"={"method"="GET"}}
|
||||
* )
|
||||
* @ORM\Table(name="question")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\QuestionRepository")
|
||||
*/
|
||||
|
@ -60,6 +55,11 @@ class Question
|
|||
return $question;
|
||||
}*/
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getText();
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
|
|
|
@ -9,7 +9,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
use ApiPlatform\Core\Annotation\ApiSubresource;
|
||||
|
||||
/**
|
||||
* @ApiResource()
|
||||
* @ApiResource(
|
||||
* collectionOperations={"get"={"method"="GET"}},
|
||||
* itemOperations={"get"={"method"="GET"}}
|
||||
* )
|
||||
* @ORM\Table(name="response")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ResponseRepository")
|
||||
*/
|
||||
|
@ -36,6 +39,7 @@ class Response
|
|||
/**
|
||||
* @ORM\OneToOne(targetEntity="App\Entity\Question", cascade={"persist", "remove"})
|
||||
* @ORM\JoinTable(name="question")
|
||||
* @ApiSubresource()
|
||||
*/
|
||||
private $child;
|
||||
|
||||
|
|
|
@ -19,22 +19,19 @@ class QuestionRepository extends ServiceEntityRepository
|
|||
parent::__construct($registry, Question::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Question[] Returns an array of Question objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
/**
|
||||
* @return Question[] Returns an array of Question objects
|
||||
*/
|
||||
public function findByToken($token)
|
||||
{
|
||||
return $this->createQueryBuilder('q')
|
||||
->andWhere('q.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('q.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->andWhere('q.token = :token')
|
||||
->setParameter('token', $token)
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?Question
|
||||
|
|
Loading…
Reference in New Issue