Custom Filter getDescription properties
... Doctrine ORM... it's actually impossible to see which
one we have here... so I'll randomly guess:
Hey! I got it! If you chose the wrong one, you'll have to delete your project and
start over. Or... just delete this one ...
Setting a Custom Field Via a Listener
...
null if the user isn't logged in:
If there is no user, just return. But if there is a user, call
$user->setIsMe(true):
Cool! We just set the $isMe field on the authenticated User object. One cool
thing about Doctrine is ...
Foundry Tricks
... fixtures:
Then... refresh the homepage.
All good! If we dug into the database, we'd find 20 published questions and five
unpublished. Foundry can do more - especially with Doctrine relations and testing -
and we'll talk ...
Fetching Data The Repository
... findOneBy(). Pass this an array of the WHERE
statements we need: 'slug' => $slug. After, dd($question).
Ok, let's see what this returns! Refresh and... woohoo! This gives us a Question
object. Doctrine finds the matching row ...
Migrations
We have a beautiful new Question entity class that is supposed to map to a
question table in the database. But... that table does not exist yet.
How can we create it?
Well, because Doctrine has all of this configuration ...
Fixing our Deprecations Form Controller Mailer
... all the
ones from doctrine/persistence because they're not related to Symfony.
With that in mind... if you look closely, there are really only two real
deprecations left... and they look like the same thing: something ...
AMQP Priority Exchange
... bound to.
This did work before with Doctrine, thanks to this queue_name: high option.
The default value for this option is... default. As a reminder, I'll quickly
log into my database ...
Adding the plainPassword Field
... do this is via a Doctrine event listener or
entity listener, which are more or less the same thing. That's a fine option...
though things can get tricky when a user is updating their password. We talk
about that on an ...
High Priority Transports
... Let's use the same DSN as before, which in our
case is using doctrine. Below, add options, then queue_name set to high.
The name high isn't important - we could use anything. The queue_name option
is specific to the ...
Worker Command
Even if I refresh the page, now that our messages aren't being handled immediately...
the four most recent photos don't have Ponka in them. That's tragic! Instead, those
messages were sent to the doctrine transport and ...
Validation
... a database error
because of a new feature where validation rules are automatically added by reading
the Doctrine database rules.
But, whether you're seeing a 500 error, or Symfony is at least adding some basic ...
Filtering Searching
... support Doctrine ORM and Doctrine with MongoDB. Make sure to choose
the class for the ORM.
Ok, now move over and refresh again.
We're back to life! Click "Try it out". Hey! We have a little isPublished filter
input box! If ...
A bit of Security Cleanup
... tell isEmpty() to do that! Open User and look for that articles
property. At the end of the @OneToMany annotation, add fetch="EXTRA_LAZY". We
talked about this option in our Doctrine relations tutorial. With this set ...
The Edit Form
... "edit" form. Even Doctrine is smart
enough to know that it needs to update this Article in the database instead of
creating a new one. Booya!
The real differences between the two forms are all the small details. Update ...
HTML5 Sanity Validation
... to true for every field... no matter
what... which can be kind of annoying & surprising. However, when you bind your
form to an entity class, the form field guessing system uses the nullable Doctrine
option to choose the ...
Article Admin Low-Level Access Controls
... "Proxies" thing, ignore
it. This is an internal object that Doctrine sometimes wraps around your entity
in order to enable some of its lazy-loading relation awesomeness. The object looks
and works exactly like User.
Second ...
Pagination
... it stops working.
If you ever need to query and render more than 100 Doctrine entities, you're going
to have slow loading times. If you try to print 1000, your page probably just won't load.
But no problem! Printing that ...
Updating an Entity
... after updating the object, just call $em->flush():
But wait! I did not call $em->persist($article). We could call this...
it's just not needed for updates! When you query Doctrine for an object, it already
knows that you ...
Flex Extras
... run:
composer update doctrine/doctrine-fixtures-bundle
Version 3 of this bundle is all new... but not in a "broke everything" kind of
way. Before, fixture classes were loaded because ...
Migrating Services Security
Ok, remember our goal: to move our code - which mostly lives in config/ - into
the new directory structure.
The next section is doctrine... and there's nothing special here: this is the
default config from Symfony 3 ...
2725
Doctrine
Filter Results