2709 search results for Doctrine

... I cann't find any information about cascade operation in symfony 4 doctrine tutorial, doest it mean do not use it beacuse it's bad practise or what ? ;)
after entering the Entity shortcut name I get... [Doctrine\DBAL\Exception\ConnectionException] An exception occured in driver: SQLSTATE[HY000] [1049] Unknown database 'symfony' ...
Justice Sommer
Justice Sommer
Read Full Comment
I have 3rd party desktop software but I know how password was hashed so I maped table to doctrine enitity and created CustomAuthenticator. :) ...
It will be great to add a new screencast about Doctrine Criteria to this tutorial. I think they awesome too! :) What do you think, Ryan? ...
Which doctrine annotation should I use if I really wanted to assign a $genusScientist to another $genus instead of completely removing it from the database? Thanks. ...
Hey Chris, Thank you for reporting it! I fixed both broken links in https://github.com/knpuniversity/doctrine-queries/commit/7fb9b5125554ec985718d0bd3b025bd30afd8e6e Cheers! ...
+1. Apparently we have to wait for a Symfony update https://stackoverflow.com/questions/51342512/user-deprecated-doctrine-common-classloader-is-deprecated ...
Trafficmanagertech
Trafficmanagertech
Read Full Comment
I need to create some Doctrine Entities in my bundle, to be used by the external App. How can I add and configure these Entities? ...
Lucas Baldassari
Lucas Baldassari
Read Full Comment
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
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
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
// ... 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
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
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
19 lines | config/packages/doctrine.yaml
doctrine:
dbal:
// ... lines 3 - 4
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
// ... lines 8 - 19
See Code Block in Script
64 lines | src/Controller/QuestionController.php
// ... lines 1 - 7
use Symfony\Component\HttpFoundation\Response;
// ... lines 9 - 10
class QuestionController extends AbstractController
{
// ... lines 13 - 55
/**
* @Route("/questions/new")
*/
public function new()
{
return new Response('Time for some Doctrine magic!');
}
}
See Code Block in Script
62 lines | .env
// ... lines 1 - 55
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###
See Code Block in Script
67 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 16
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 19 - 35
public static function createNonDeletedCriteria(): Criteria
{
return Criteria::create()
->andWhere(Criteria::expr()->eq('isDeleted', false))
->orderBy(['createdAt' => 'DESC'])
;
}
// ... lines 43 - 65
}
See Code Block in Script
// ... lines 1 - 5
use App\Photo\PhotoFileManager;
use Doctrine\ORM\EntityManagerInterface;
class DeleteImagePostHandler
{
private $photoManager;
private $entityManager;
public function __construct(PhotoFileManager $photoManager, EntityManagerInterface $entityManager)
{
$this->photoManager = $photoManager;
$this->entityManager = $entityManager;
}
// ... lines 19 - 27
}
See Code Block in Script
36 lines | .env
// ... lines 1 - 29
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###
See Code Block in Script