Fixing N+1 With a Join
We made a huge leap forward by telling Doctrine to make COUNT queries to
count the comments for each BigFootSighting... instead of querying for all the
comments just to count them. That's a big win.
Could we go further ...
Comparisons Validate Performance Changes Find Side Effects
... one.
Next: Blackfire has a deep understanding of PHP, database queries, Redis calls
and even libraries like Symfony, Doctrine, Magento, Composer, eZ platform,
Wordpress and others. Thanks to that, it automatically detects problems
and recommends solutions.
Mapping Messages to Classes in a Transport Serializer
... single message bus and the Doctrine transport. Or, you
can go crazy: create multiple transports, send things to RabbitMQ, create custom
exchanges with binding keys or use your own serializer to... well... basically
do ...
API Debugging with the Profiler
... anyways, like the POST parameters, the request headers, request
content - which is really important when you're sending JSON - and all the
goodies that you expect - cache, performance, security, Doctrine, etc.
In ...
Autocomplete Endpoint Serialization Group
... A circular reference has
been detected. This is a common problem with the serializer and Doctrine objects.
Check it out: open the User class. By default, the serializer will serialize
every property... or more ...
Field Types Options
... be.
But, we now know that, because we've bound our form to our entity, the form type
"guessing" system is able to read the Doctrine metadata, notice that content
looks like a big field, and "guess" that it should be a ...
Giving the Comments an isDeleted Flag
... Doctrine, the value on your
entity will be true or false, but in the database, it stores as a tiny int with
a zero or one.
This looks good, so move back and.... migrate!
php bin ...
Awesome Random Fixtures
...
To celebrate, move over, refresh and... awesome! 8, random comments. We rock!
Next, let's learn about some tricks to control how Doctrine fetches the
comments for an article, like, their order.
Fun with Commands
...
Guess what? Commands are services. So if you needed your SlackClient service,
you would just add a __construct() method and autowire it!
With our new knowledge, let's keep going and start mastering features, like the
Doctrine ORM, form system, API stuff and a lot more.
Alright guys, seeya next time!
More about List Field Types
... types,
including all of the Doctrine field types and a few special fancy ones from EasyAdminBundle,
like toggle. The "toggle" type is actually super cool: it renders the field as
a little switch that turns the value on ...
CollectionType Field
...
inverse sides of the relationship, and things called orphanRemoval and cascading.
There is some significant Doctrine magic going on behind the scenes to get it working.
So in a few minutes, we're going to look at a more ...
DQL Filtering Sorting
... that you're building a
query in Doctrine. So, entity.speciedCount >= 50000:
The alias will always be entity.
Try it! Ten down to... only 7 menacing genuses!
And just like any query, you can get more complex. How about ...
Dynamic Roles and Canonical Fields
... field. I'll hold command and click to open the base User class from
FOSUserBundle. See, roles holds an array. When you save, it automatically serializes
to a string in the database. This is done with the Doctrine array ...
When I do Something Handling the Current User
... be the author for those products:
Now, add an if statement that says, if $author is passed then, $product->setAuthor():
I already have that relationship setup with in Doctrine. Great!
In thereAreProducts(), change the ...
SELECT the SUM or COUNT
In every query so far, Doctrine gives us objects. That's its default mode,
but we can also easily use it to select specific fields.
On our category page, you can see how many of each fortune has been printed
over time ...
Filtering Searching
... use setParameter('filter' , '%'.$filter.'%'). Finish things by returning $qb
at the bottom:
If you were using something like Elastic Search, then you wouldn't be making this
query through Doctrine: you'd be doing it ...
DoctrineExtensions Sluggable
... the only thing we need is under the orm.default key: add
sluggable: true:
This library adds several different magic behaviors to Doctrine, and sluggable -
the automatic generation of a slug - is just one of them. And ...
Create Genus Note
... It's you again! Welcome back friend! In this tutorial, we're diving back into
Doctrine: this time to master database relations. And to have fun of course - databases
are super fun.
Like usual, you should code along with ...
Adding a Cache Service
... Prototype comment above that is a
confusing term that means that we can call this name anything we want. Let's make
it my_markdown_cache:
You'll see how that's important in a second.
Finally, tell Doctrine what type of ...
Config.yml Control Center for Services
... parameters - which we'll talk
about soon - every root key in this file - like framework, twig and doctrine -
corresponds to a bundle that is being configured:
All of this stuff under framework is configuration for the ...
2725
Doctrine
Filter Results