2709 search results for Doctrine

... Eventually stopped on package "ruvents/doctrine-fixes-bundle", which fixes it. But I think it's a dirty hack. If you know, maybe there's another solution?
... I didn't know my mistake or not, but if I didn't write: use Doctrine\Bundle\FixturesBundle\BaseFixture; I can't do doctrine:fixtures:load ...
Hey Steffen, We're sorry about that! I just double checked our source code for this chapter: https://github.com/knpuniversity/symfony4/blob/master/knpu/ep3b-doctrine-relations/twig-extensions-library.md - it looks good ...
... Hello, I'm trying to start that code on symfony 4, but I got this error: Cannot autowire service "App\Service\MarkdownTransformer": argument "$cache" of method "__construct()" references interface "Doctrine\Common ...
... I've personally found this part is super-exciting - https://knpuniversity.com/screencast/doctrine-relations/collection-criteria#using-the-criteria-in-a-querybuilder We can create a helper class with all this static ...
toporovvv
toporovvv
Read Full Comment
I have used doctrine for years now and I keep learning new things that make it so much better. Thanks. May I ask, when will the next course come out? Should I review the Symfony 3 Forms: Build, Render & Conquer! for the latest info on forms or is there something better to review? ...
Hey Jean-tilapin I'm glad to hear that you could fix your problem, but I believe what happened was that for some reason the doctrine bundle recipe didn't get installed. When that happens, you can run `composer fix-recipes` and if it was missing, it will install it for you :) Cheers! ...
MolloKhan
MolloKhan
Read Full Comment
... app.doctrine.hash_password_listener: class: AppBundle\Doctrine\HashPasswordListener autowire: true tags: - { name: doctrine.event_listener, event: prePersist, lazy: true }
Hey Krzysztof K. Very interesting question! Honestly, I haven't had the need (or obligation) of using a composite primary key for my entities, but I found a nice article about how to do it: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/composite-primary-keys.html I hope it helps. Cheers! ...
MolloKhan
MolloKhan
Read Full Comment
Hey Lucas Baldassari Sorry for the late replay. If your test class extends from "KernelTestCase" or "WebTestCase", you should be able to get Doctrine from the container, but you have to boot the kernel first. Maybe ...
MolloKhan
MolloKhan
Read Full Comment
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
93 lines | src/Entity/Question.php
// ... lines 1 - 2
namespace App\Entity;
use App\Repository\QuestionRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=QuestionRepository::class)
*/
class Question
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=100)
*/
private $slug;
/**
* @ORM\Column(type="text")
*/
private $question;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $askedAt;
// ... lines 39 - 91
}
See Code Block in Script
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
See Code Block in Script
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
# failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
# async: '%env(MESSENGER_TRANSPORT_DSN)%'
# failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
# Route your messages to the transports
# 'App\Message\YourMessage': async
See Code Block in Script
36 lines | src/Test/CustomApiTestCase.php
// ... lines 1 - 8
class CustomApiTestCase extends ApiTestCase
{
protected function createUser(string $email, string $password): User
{
$user = new User();
$user->setEmail($email);
$user->setUsername(substr($email, 0, strpos($email, '@')));
$user->setPassword($password);
$em = self::$container->get('doctrine')->getManager();
$em->persist($user);
$em->flush();
return $user;
}
// ... lines 24 - 35
}
See Code Block in Script
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
# failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transports
# async: '%env(MESSENGER_TRANSPORT_DSN)%'
# failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
# Route your messages to the transports
# 'App\Message\YourMessage': async
See Code Block in Script
114 lines | src/Entity/User.php
// ... lines 1 - 2
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*/
class User implements UserInterface
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $email;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
// ... lines 35 - 112
}
See Code Block in Script
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
See Code Block in Script
224 lines | src/AppBundle/Entity/Genus.php
<?php
// ... lines 2 - 18
class Genus
{
// ... lines 21 - 163
public function getFirstDiscoveredAt(): ?\DateTimeInterface
// ... lines 165 - 168
public function setFirstDiscoveredAt(\DateTime $firstDiscoveredAt = null): void
// ... lines 170 - 173
public function getSlug(): ?string
// ... lines 175 - 178
public function setSlug(?string $slug): void
// ... lines 180 - 183
public function addGenusScientist(GenusScientist $genusScientist): void
// ... lines 185 - 194
public function removeGenusScientist(GenusScientist $genusScientist): void
// ... lines 196 - 205
/**
* @return Collection|GenusScientist[]
*/
public function getGenusScientists(): Collection
// ... lines 210 - 213
/**
* @return \Doctrine\Common\Collections\Collection|GenusScientist[]
*/
public function getExpertScientists(): Collection
// ... lines 218 - 222
}
See Code Block in Script
50 lines | src/AppBundle/Form/GenusFormType.php
// ... lines 1 - 6
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
// ... lines 10 - 13
class GenusFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('subFamily', EntityType::class, [
// ... lines 21 - 25
])
// ... lines 27 - 28
->add('isPublished', ChoiceType::class, [
// ... lines 30 - 33
])
// ... lines 35 - 39
;
}
// ... lines 42 - 48
}
See Code Block in Script