1000 search results

Configuring our Bundle's Entity

…right now. This command also shows mapped superclasses, so we need to do some work to get our Translation class to show up here. You're probably used to using mapping attributes for your Doctrine entities. In bundles, it's a bit different. The official…

4:09
Worker Command

…them. That's tragic! Instead, those messages were sent to the doctrine transport and are waiting patiently inside of a messenger_messages table. So... how can we read these back out and process them? We need something that can fetch each row one-by-one…

5:34
Refactoring `ObjectTranslator`

…a constructor for this class... and open it up to give us some space. Now copy the Doctrine-related properties from ObjectTranslator's constructor ($translationClass and $doctrine) and paste them into our new constructor: This paves the way for our next method, public function idFor()…

4:46
Filters: Automatically Modify Queries

…But what if we want to apply some criteria like this globally to every query to a table? Like, telling Doctrine that whenever we query for fortune cookies, we want to add a WHERE discontinued = false to that query. That sounds crazy. And yet…

6:59
Reusable Entity->Dto Provider & Processor

Our UserAPI is now a fully functional API resource class! We've got our EntityToDtoStateProvider, which calls the core state provider from Doctrine, and that gives us all the good stuff, like querying, filtering, and pagination. Then, down here, we leverage the MicroMapper system to…

4:11
Provider: Transforming Entities to DTOs

Let's keep track of the goal. When we first used stateOptions, it triggered the core Doctrine collection provider to be used. That's great... except that it returns User entities, meaning that those became the central objects for the UserApi endpoints. That causes a…

4:47
Entities, DTO's & The "Central" Object

…too good to be true. It gives us all the flexibility, in theory, of a custom class, while reusing all the core Doctrine provider and processor logic. But hold your horses because there are two, albeit fixable, snags. Most importantly, we're not allowed to…

6:24
Développement d'applications TDD avec Symfony et ses amis en situation réelle (Chris Holland)

…gestion des utilisateurs, tests d'acceptation et tests unitaires. Mise en place de Doctrine avec PHPUnit, pour permettre un workflow TDD hautement productif. Tester ses classes Repository avec des opérations réelles sur les données tout en conservant une vitesse fulgurante. Tester ses Entity dans le…

37:31
Migrations

…run: symfony console doctrine:migrations:migrate Say y to confirm and... beautiful! It tells us that it's Migrating up to that specific version. It seems... like that worked! To make sure, you can try another bin/console command: symfony console doctrine:query:sql with…

4:14
DQL & The Query Builder

…back is a custom class. Well, technically you don't have to have a custom repository class - and if you don't, Doctrine will just give you an instance of EntityRepository. But in practice, I always have custom repository classes. Anyways, when we ask for…

6:49
Data Persister: Encoding the Plain Password

…users, we need to be able to run some code after API Platform deserializes the JSON into a User object, but before it gets saved to Doctrine. That code will encode the plainPassword and set it on the password property. How can we do that…

8:03
Owning Vs Inverse Relations

We need to talk about a very, very important and, honestly, super-confusing part of Doctrine relations! Listen closely: this is the ugliest thing we need to talk about. So, let's get through it, put a big beautiful check mark next to it, then…

7:26
Adding the ManyToOne Relation

…to have many Comments... and we want each Comment to belong to one Article. Forget about Doctrine for a minute: let's think about how this should look in the database. Because each Comment should belong to one article, this means that the comment table…

9:14
Adding a Comment Entity

Hey friends! I mean, hello fellow space-traveling developer... friends. Welcome, to part two of our Doctrine tutorial where we talk all about... relationships. Oh, I love relationships, and there are so many beautiful types in the universe! Like, the relationship between two old friends…

5:04
Dynamic Roles and Canonical Fields

Let's see what this all looks like in the database! To query the user table, we can actually use the console: php bin/console doctrine:query:sql 'SELECT * FROM user' Nice! We inherited a bunch of columns from the base User class, like username…

5:17
JOINs!

…do! I mean, a query isn't truly interesting unless you're joining across tables to do some query Kung fu. Doctrine makes JOINs really easy - it's one of my favorite features! Heck, they're so easy that I think it confuses people. Let…

3:27
An Aside: Dependency Injection Parameters

…forms stuff and open config.yml. Under the doctrine key, we see a bunch of percent sign values: # app/config/config.yml # ... doctrine: Whenever you see something surrounded by two percent signs in a config file, it’s a parameter. Parameters are like variables: you…

1:41
Keep Going!

…was probably the most important episode yet, and you made it. Congrats! The first big piece included the two main Doctrine associations: ManyToOne and ManyToMany. We saw how each can have an optional inverse side, like the OneToMany side of ManyToOne. The second huge piece…

1:19
OneToMany: The Inverse Side of a Relationship

…we gave every Event an owner. This was our first Doctrine relationship: a ManyToOne from Event to User. This lets us do things like call $event->getOwner(). Let’s use this to print the owner of an Event: {# src/Yoda/EventBundle/Resources/views/Event/show…

5:37
Fixtures: For some dumb data

…it there: To see if it's working, try getting help information on a new doctrine:fixtures:load console task that comes from the bundle: php app/console doctrine:fixtures:load --help We see the help information, so we're ready to write some fixtures…

1:54