2726 search results for Doctrine

60 lines | src/AppBundle/Form/GenusFormType.php
// ... lines 1 - 7
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
// ... lines 9 - 16
class GenusFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
// ... line 22
->add('subFamily', EntityType::class, [
'placeholder' => 'Choose a Sub Family',
'class' => SubFamily::class,
'query_builder' => function(SubFamilyRepository $repo) {
return $repo->createAlphabeticalQueryBuilder();
}
])
// ... lines 30 - 49
;
}
// ... lines 52 - 58
}
See Code Block in Script
50 lines | src/AppBundle/Form/GenusFormType.php
// ... lines 1 - 6
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
// ... lines 8 - 13
class GenusFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
// ... line 19
->add('subFamily', EntityType::class, [
'placeholder' => 'Choose a Sub Family',
'class' => SubFamily::class,
'query_builder' => function(SubFamilyRepository $repo) {
return $repo->createAlphabeticalQueryBuilder();
}
])
// ... lines 27 - 39
;
}
// ... lines 42 - 48
}
See Code Block in Script
56 lines | src/Controller/ArticleAdminController.php
// ... lines 1 - 5
use Doctrine\ORM\EntityManagerInterface;
// ... lines 7 - 10
class ArticleAdminController extends AbstractController
{
// ... lines 13 - 15
public function new(EntityManagerInterface $em)
{
// ... lines 18 - 45
$em->persist($article);
$em->flush();
return new Response(sprintf(
'Hiya! New Article id: #%d slug: %s',
$article->getId(),
$article->getSlug()
));
}
}
See Code Block in Script
56 lines | src/Controller/ArticleAdminController.php
// ... lines 1 - 5
use Doctrine\ORM\EntityManagerInterface;
// ... lines 7 - 10
class ArticleAdminController extends AbstractController
{
// ... lines 13 - 15
public function new(EntityManagerInterface $em)
{
// ... lines 18 - 40
// publish most articles
if (rand(1, 10) > 2) {
$article->setPublishedAt(new \DateTime(sprintf('-%d days', rand(1, 100))));
}
$em->persist($article);
$em->flush();
// ... lines 48 - 53
}
}
See Code Block in Script
// ... lines 1 - 5
use ApiPlatform\Doctrine\Orm\Extension\QueryItemExtensionInterface;
// ... lines 7 - 11
class DragonTreasureIsPublishedExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface
{
// ... lines 14 - 24
public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, Operation $operation = null, array $context = []): void
{
// TODO: Implement applyToItem() method.
}
}
See Code Block in Script
131 lines | src/Entity/User.php
// ... lines 1 - 10
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
// ... lines 12 - 18
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
#[UniqueEntity(fields: ['username'], message: 'It looks like another dragon took your username. ROAR!')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
// ... lines 23 - 129
}
See Code Block in Script
57 lines | src/Controller/VinylController.php
// ... lines 1 - 5
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
// ... lines 8 - 12
class VinylController extends AbstractController
{
// ... lines 15 - 38
public function browse(VinylMixRepository $mixRepository, string $slug = null): Response
{
// ... lines 41 - 43
$adapter = new QueryAdapter($queryBuilder);
$pagerfanta = Pagerfanta::createForCurrentPageWithMaxPerPage(
$adapter,
1,
9
);
// ... lines 50 - 54
}
}
See Code Block in Script
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{# this template is used to display Doctrine entity primary keys #}
<span class="fa fa-key"></span> {{ field.formattedValue }}
See Code Block in Script
87 lines | src/Controller/QuestionController.php
// ... lines 1 - 9
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
// ... lines 12 - 17
class QuestionController extends AbstractController
{
// ... lines 20 - 32
public function homepage(QuestionRepository $repository)
{
$queryBuilder = $repository->createAskedOrderedByNewestQueryBuilder();
$pagerfanta = new Pagerfanta(new QueryAdapter($queryBuilder));
$pagerfanta->setMaxPerPage(5);
// ... lines 39 - 42
}
// ... lines 44 - 85
}
See Code Block in Script
... ", "behat/mink-selenium2-driver": "^1.3", "braincrafted/bootstrap-bundle": "^2.2", "components/jquery": "^3.2", "doctrine/data-fixtures": "^1.2", "doctrine/doctrine-bundle": "^1.6 ...
... with. Here is the link to those chapters - you can read the content now, the videos will be there over the next 2 days: * https://knpuniversity.com/screencast/symfony-doctrine/fixtures * https://knpuniversity.com ...
weaverryan
weaverryan
Read Full Comment
... persist($question) *and* also iterate over all your answers and call persist() on each of them. I think you confuse Doctrine with it, Doctrine works with ArrayCollection if we're talking about OneToMany relation. So, I ...
Hi, I need to place a query (that is not possible to write with doctrine entities(?)) in the symfony form query_builder. SELECT `id` as `categoryId`,`name`,`parent_id` as `parentId`, ( SELECT LPAD ...
Paweł C.
Paweł C.
Read Full Comment
Hi again Diego, it's been a while since I was here for last time, but I managed to google out the solution for my Doctrine problem, and perhaps someone else will find it useful in case of similar difficulties. It seems ...
Jan Zioło
Jan Zioło
Read Full Comment
Hey Szymon Chomej! So, it's basically *not* possible for the user to create an entity. In theory it's possible, but it's not how Doctrine is meant to work - so probably not a good solution to investigate :). And ...
weaverryan
weaverryan
Read Full Comment
... we *do* need to change *some* persisted field on `User` in order to trigger the Doctrine listener. I would add an updatedAt field, and have it be set with a Lifecyclecallback (PreUpdate) - just like we did a few ...
weaverryan
weaverryan
Read Full Comment
Hi, I have problem when install the bundle. Using version ^1.3 for doctrine/doctrine-migrations-bundle ./composer.json has been updated Loading composer repositories with package information Updating dependencies ...
Darmanto Yang
Darmanto Yang
Read Full Comment
... ) Doctrine give us a way to manage subclass entities, there are two ways, via single table or multiple tables (each for subclass). Of course this depends on your use case, but if you are not going to add extra fields specific to ...
MolloKhan
MolloKhan
Read Full Comment
... see you have a new SQLite 3 installed. Probably, you have an older version of "doctrine/dbal" that does not support it yet. I'd recommend to upgrade "doctrine/dbal" to the latest available version, or, downgrade your ...
... changing the type-hint for argument "$em" of method "AppBundle\Service\MarkdownTransformer::__construct()" to one of its parents: interface "Doctrine\ORM\EntityManagerInterface", or interface "Doctrine\Common ...
Marco Koopman
Marco Koopman
Read Full Comment