Criteria Filter Relation Collections
... hiding the discontinued ones.
Open up the Category entity and find getFortuneCookies(). There it
is. Below, add a new method called getFortuneCookiesStillInProduction(). This,
like the normal method, will return a Doctrine ...
Triaging a Bug Issue
... when trying to serialize a Doctrine
QueryBuilder with the web profiler: something about not being able to serialize
a PDO instance.
The web profiler works by collecting a bunch of information about the request
and ...
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 ...
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 ...
SELECTing into a New DTO Object
Having the flexibility to select any data we want is awesome. Dealing with
the associative array that we get back is... less awesome! I like to work with
objects whenever possible. Fortunately, Doctrine gives us a ...
The symfony console Command server_version
Doctrine is now configured to talk to our database, which lives inside a Docker
container. That's thanks to the fact that the Symfony dev server exposes
this DATABASE_URL environment variable, which points to the ...
ManyToMany Relation
... foreign key column and a tag_id foreign key column. That's it.
And... this makes sense! Even outside of Doctrine, this is how you build a
ManyToMany relationship: you create a "join table" that keeps track of which
tags ...
doctrine:database:create server_version
... var:export, you can see
that the database name is apparently "main". But that does not exist yet.
No problem! When we installed Doctrine, it added a bunch of new bin/console
commands to our app. Run ...
Hunting the Final Deprecations
... "pipe" it to grep Deprecated:
We're now watching the log file for any lines that contain Deprecated. Unfortunately,
because of that annoying doctrine/persistence stuff, it does contain extra
noise. But it'll still work ...
Problems with Entities in Messages
... Doctrine keeps track of a list of all
the entity objects that it's currently dealing with. When you query for an entity,
it adds it to this list. When you call persist(), if it's not already in the list,
it's added. Then ...
JOINs
I love JOINs. I 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 ...
And WHERE Or WHERE
The most common thing to do in a query is to add a WHERE clause. Unfortunately,
Doctrine doesn't support that. I'm kidding!
I have a search box - let's search for "Lucky Number". This isn't hooked
up yet, but it adds a ...
Saving the Inverse Side of a ManyToMany
... What's going on!?
This is the moment where someone who doesn't know what we're about to learn,
starts to hate Doctrine relations.
Earlier, we talked about how every relationship has two sides. You can start with
a Genus ...
Adding Outside Bundles with Composer
...
our pre-started project that came with Symfony and other tools like Doctrine.
Unfortunately, it didn't come with any tools for handling fixtures.
But we're smart enough: let's just add a fixtures library ourselves. And ...
Entities DTO's The Central Object
This entity class thing seems almost 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 ...
Querying the Database
... Now that we've saved some stuff to the database, how can we read or query for it?
Once again, at least for simple stuff, Doctrine doesn't want you to worry about
querying. Instead, we just ask Doctrine for the objects ...
Persisting to the Database
... Doctrine will
handle the insert queries for us.
To help do this in the simplest way possible, let's make a fake "new Vinyl Mix"
page.
In the src/Controller/ directory, create a new MixController class and make
this extend the ...
Relation OrderBy fetch=EXTRA_LAZY
... ... simply to count them! That's total overkill!
As soon as we access this answers property, Doctrine queries for all the data
so that it can return all of the Answer objects. Normally, that's great - because
we do want ...
Data Persister Decoration
... save or persist that object. Usually, this means that we're saving an entity
object to the database via Doctrine. But we could "save" an object anywhere, like
by sending the data to another API, or putting it into Redis ...
ManyToMany Relationship
... owning versus inverse stuff is important because, when Doctrine
saves an entity, it only looks at the owning side of the relationship to figure
out what to save to the database. So, if we add tags to an article, Doctrine ...
2708
Doctrine
Filter Results