1000 search results

// ... lines 1 - 5
use Doctrine\ORM\QueryBuilder;
// ... lines 7 - 12
class QuestionCrudController extends AbstractCrudController
{
// ... lines 15 - 19
public function configureFields(string $pageName): iterable
{
// ... lines 22 - 29
yield AssociationField::new('askedBy')
// ... lines 31 - 38
->setQueryBuilder(function (QueryBuilder $qb) {
// ... lines 40 - 41
});
// ... lines 43 - 44
}
}
See Code Block in Script
89 lines | src/Controller/RegistrationController.php
// ... lines 1 - 7
use Doctrine\ORM\EntityManagerInterface;
// ... lines 9 - 16
class RegistrationController extends AbstractController
{
// ... lines 19 - 61
public function verifyUserEmail(Request $request, VerifyEmailHelperInterface $verifyEmailHelper, UserRepository $userRepository, EntityManagerInterface $entityManager): Response
{
// ... lines 64 - 86
}
}
See Code Block in Script
221 lines | src/Entity/User.php
// ... lines 1 - 5
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
// ... lines 8 - 17
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
// ... lines 20 - 51
/**
* @ORM\OneToMany(targetEntity=Question::class, mappedBy="owner")
*/
private $questions;
public function __construct()
{
$this->questions = new ArrayCollection();
}
// ... lines 61 - 190
/**
* @return Collection|Question[]
*/
public function getQuestions(): Collection
{
return $this->questions;
}
public function addQuestion(Question $question): self
{
if (!$this->questions->contains($question)) {
$this->questions[] = $question;
$question->setOwner($this);
}
return $this;
}
public function removeQuestion(Question $question): self
{
if ($this->questions->removeElement($question)) {
// set the owning side to null (unless already changed)
if ($question->getOwner() === $this) {
$question->setOwner(null);
}
}
return $this;
}
}
See Code Block in Script
188 lines | src/Entity/Question.php
// ... lines 1 - 7
use Doctrine\Common\Collections\Criteria;
// ... lines 9 - 15
class Question
{
// ... lines 18 - 157
public function getApprovedAnswers(): Collection
{
$criteria = Criteria::create()
// ... lines 161 - 163
}
// ... lines 165 - 186
}
See Code Block in Script
188 lines | src/Entity/Question.php
// ... lines 1 - 7
use Doctrine\Common\Collections\Criteria;
// ... lines 9 - 15
class Question
{
// ... lines 18 - 157
public function getApprovedAnswers(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('status', Answer::STATUS_APPROVED));
// ... lines 162 - 163
}
// ... lines 165 - 186
}
See Code Block in Script
188 lines | src/Entity/Question.php
// ... lines 1 - 7
use Doctrine\Common\Collections\Criteria;
// ... lines 9 - 15
class Question
{
// ... lines 18 - 157
public function getApprovedAnswers(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('status', Answer::STATUS_APPROVED));
return $this->answers->matching($criteria);
}
// ... lines 165 - 186
}
See Code Block in Script
29 lines | src/Repository/AnswerRepository.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 15
class AnswerRepository extends ServiceEntityRepository
{
// ... lines 18 - 22
public static function createApprovedCriteria(): Criteria
{
return Criteria::create()
->andWhere(Criteria::expr()->eq('status', Answer::STATUS_APPROVED));
}
}
See Code Block in Script
178 lines | src/Entity/Question.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Collection;
// ... lines 8 - 14
class Question
{
// ... lines 17 - 147
/**
* @return Collection|Answer[]
*/
public function getAnswers(): Collection
{
return $this->answers;
}
public function addAnswer(Answer $answer): self
{
if (!$this->answers->contains($answer)) {
$this->answers[] = $answer;
$answer->setQuestion($this);
}
return $this;
}
public function removeAnswer(Answer $answer): self
{
if ($this->answers->removeElement($answer)) {
// set the owning side to null (unless already changed)
if ($answer->getQuestion() === $this) {
$answer->setQuestion(null);
}
}
return $this;
}
}
See Code Block in Script
178 lines | src/Entity/Question.php
// ... lines 1 - 5
use Doctrine\Common\Collections\ArrayCollection;
// ... lines 7 - 14
class Question
{
// ... lines 17 - 56
public function __construct()
{
$this->answers = new ArrayCollection();
}
// ... lines 61 - 176
}
See Code Block in Script
224 lines | src/AppBundle/Entity/Genus.php
// ... lines 1 - 5
use Doctrine\Common\Collections\Criteria;
// ... lines 7 - 15
class Genus
{
// ... lines 18 - 214
public function getExpertScientists()
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->gt('yearsStudied', 20))
->orderBy(['yearsStudied' => 'DESC']);
// ... lines 220 - 221
}
}
See Code Block in Script
224 lines | src/AppBundle/Entity/Genus.php
// ... lines 1 - 5
use Doctrine\Common\Collections\Criteria;
// ... lines 7 - 15
class Genus
{
// ... lines 18 - 214
public function getExpertScientists()
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->gt('yearsStudied', 20))
->orderBy(['yearsStudied' => 'DESC']);
return $this->getGenusScientists()->matching($criteria);
}
}
See Code Block in Script
// ... lines 1 - 5
use Doctrine\Common\Collections\Criteria;
// ... lines 7 - 8
class GenusRepository extends EntityRepository
{
// ... lines 11 - 26
static public function createExpertCriteria()
{
return Criteria::create()
->andWhere(Criteria::expr()->gt('yearsStudied', 20))
->orderBy(['yearsStudied' => 'DESC']);
}
}
See Code Block in Script
47 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 7
use Doctrine\Persistence\ManagerRegistry;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
class CheeseSearchFilter extends AbstractFilter
{
public function __construct(ManagerRegistry $managerRegistry, ?RequestStack $requestStack = null, LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null)
{
parent::__construct($managerRegistry, $requestStack, $logger, $properties, $nameConverter);
}
// ... lines 19 - 45
}
See Code Block in Script
// ... lines 1 - 5
use Doctrine\ORM\EntityManagerInterface;
// ... lines 7 - 9
class ValidIsPublishedValidator extends ConstraintValidator
{
private $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}
// ... lines 18 - 40
}
See Code Block in Script
25 lines | src/Validator/ValidIsPublished.php
// ... lines 1 - 4
use Doctrine\Common\Annotations\Annotation\Target;
// ... lines 6 - 7
/**
// ... line 9
* @Target({"CLASS"})
*/
class ValidIsPublished extends Constraint
{
// ... lines 14 - 23
}
See Code Block in Script
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
class CheeseListingDataPersister implements DataPersisterInterface
{
// ... line 11
private $entityManager;
public function __construct(DataPersisterInterface $decoratedDataPersister, EntityManagerInterface $entityManager)
{
// ... line 16
$this->entityManager = $entityManager;
}
// ... lines 19 - 42
}
See Code Block in Script
54 lines | src/Repository/QuestionRepository.php
// ... lines 1 - 6
use Doctrine\ORM\QueryBuilder;
// ... lines 8 - 15
class QuestionRepository extends ServiceEntityRepository
{
// ... lines 18 - 36
private function addIsAskedQueryBuilder(QueryBuilder $qb): QueryBuilder
{
// ... line 39
}
// ... lines 41 - 52
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 65
}
// ... lines 67 - 91
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 57
$entityManager->persist($question);
$entityManager->flush();
// ... lines 60 - 65
}
// ... lines 67 - 91
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 57
$entityManager->persist($question);
$entityManager->flush();
return new Response(sprintf(
'Well hallo! The shiny new question is id #%d, slug: %s',
$question->getId(),
$question->getSlug()
));
}
// ... lines 67 - 91
}
See Code Block in Script