Migrating framework Config
…Great! Delete the validation line!
What's really interesting is that enable_annotations is set to true because
it detected that we have the Doctrine annotations package installed. This is the
flow with Flex: install a package and you're done.
Ok! It might not…
Customizing the Contentful Slugger
…can run:
symfony console doctrine:migrations:migrate current-1
That will reverse the most recent migration, causing the contentful and route
tables to be dropped. Put them back with:
symfony console doctrine:migrations:migrate
Re-sync the content again:
And now check the routes:
Yes…
Content Browser: Returning the Items
…web debug toolbar, we have a 400 error.
Dang. When we open that up, we see:
Value loader for doctrine_recipe value type does not exist.
There's just one final piece we need: A very simple class called the "value
loader". That's next.
Validating Who/When Can Publish
…new data has been
deserialized into it. The failure is from our first test case: we currently
allow this item to be published, even though the description is short. Next,
let's prevent this. How? It's back to our "original data" trick from Doctrine.
Custom Resource GET Item
…Next, let's talk about
pagination. Because if we go back to /api/daily-stats.jsonld and refresh...
there are a lot of items here. Since we're not using Doctrine, we no longer
get pagination for free. If we need it, we have to…
Custom Resource PUT Operation
…But what if the built-in filters aren't enough? What if we need to add some
custom filtering logic? Let's do that next by first creating a custom filter
for a Doctrine entity and later creating a custom filter for our DailyStats
resource.
Building really fast applications (Tobias Nyholm)
…they're only heavy in when you actually using them. Makes sense. Lovely. So this is cool and all. Let's move on to doctrine. Look at this five lines of code. It's a form. For yourself, think about potential issues with this code…
Prod Vault Optimization & Vault for Tests
…Next, let's talk about a really cool new feature called "validation auto mapping".
It's a wicked-smart feature that automatically adds validation constraints based
on your Doctrine metadata and also based on the way that your PHP code is written
in your class.
Timeline: Go Behind-the-Scenes with your Code
…not that there are only 3 objects
being hydrated during this request, but that our code asks Doctrine to hydrate one
or more objects on three occasions.
So where are the 3 times that we're hydrating objects? One of the cool things is
that…
Filtering Related Collections
…method:
public function getPublishedCheeseListings() that will also return a Collection.
Inside, return $this->cheeseListings->filter(), which is a method on Doctrine's
collection object. Pass this a callback function(){} with a single CheeseListing
argument. All that function needs is return $cheeseListing->getIsPublished().
If you're…
Leverage the power of Symfony components within ApiPlatform
…composer require api
is in fact, um, launching a Flex recipe that will install API
Platform, but also the doctrine-bundle, CORS support - Cross Origin Resource
Management - and everything you need to basically have an API started. So these
three steps, and I'm done…
When Testing Makes No Sense
…you
TDD everything? Yes. I was really interested because I found TDD to be very
wrong for Symfony, the Symfony part, like using the Forms, using the Doctrine
and stuff like that. And I was wondering, okay, how do you do that? Oh, we
don…
Symfony Messenger: 6 months already and more to come
…Actually, who here is
actually is using Doctrine? I was expecting more people. So half of the room
actually admit they use Doctrine. So the idea is simple: you've got a database
URL in Doctrine, so you can configure whether it's MySQL or…
Registration Form
…console make:migration
Let's go check out that new file. Yep! No surprises: it just makes the column not
required.
Move back over and run this with:
php bin/console doctrine:migrations:migrate
Excellent! Let's try to register! Register as geordi@theenterprise.org…
Request Object & Query OR Logic
…places. One mistake could lead to an OR causing many more results
to be returned than you expect!
To best handle this in Doctrine, always use andWhere() and put all the OR logic
right inside: c.content LIKE :term OR c.authorName LIKE :term. On…
Query Joins & Solving the N+1 Problem
…make sense anymore? I mean, if we're already making a
JOIN to the article table, isn't this extra query unnecessary? Doesn't Doctrine
already have all the data it needs from the first query, thanks to the join?
The answer is... no, or…
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 will
save that correctly. But…
The Twig Extensions Library
…actually, a better question is: should
we solve this? Here's the point: you need to be aware of the fact that Doctrine's
nice relationship lazy-loading magic makes it easy to accidentally make many queries
on a page. But, it is not something…
x
1000+