Finding & Eliminating Deprecations
…at the end, it references
an issue from the doctrine/orm repository.
Ah! This deprecation isn't coming from Symfony: it's coming from
doctrine/orm! This tells us that we're going to need to make a change to our
code - at some point…
Relating Custom ApiResources
…objects... which results in it just
serializing all the properties.
This isn't a problem with entities because the serializer is smart: it reads
the Doctrine relationship metadata to figure out that a property is a collection
of some other #[ApiResource] object. Long story short…
Hello Layouts+ Setup!
…putting into them. We'll
see all of that in the Layouts admin section in a minute. To add the needed tables,
scroll up and copy this nifty doctrine:migrations:migrate line.
This is kind of cool. The layouts packages comes with migrations... and this…
All About services.yaml
…with $product = new Product(). So, these will not
be services in the container.
In the next tutorial, we'll create Doctrine entity classes, which are model classes
for the database. These will live in the src/Entity/ directory... and since
they're not meant…
Auto-complete Association Field & Controlling the Query
…debug toolbar... hover over the AJAX section and click to open
the profiler.
You're now looking at the profiler for the autocomplete AJAX call. Head over to
Doctrine section so we can see what that query looks like. Here it is. Click "View
formatted…
Always Remember Me & "signature_properties"
…s password in the database. We can cheat and do
this on the command line:
symfony console doctrine:query:sql 'UPDATE user SET password="foo" WHERE email = "abraca_admin@example.com"'
Setting the password to foo is utter nonsense... since this column needs to…
Mercure: Pushing Stream Updates Async
…some PHP and JavaScript code that's going to help us
communicate with Mercure. But... we don't actually have a Mercure service running
yet! That's like installing Doctrine... but without MySQL or Postgresql running!
So next, let's get the Mercure service running…
Unique (but not Insane) Filenames
…But if you want to guarantee cleaner filenames,
there's an easy way to do that. I'll use a class called Urlizer: this comes from
the gedmo/doctrine-extensions library. It has a nice method called
urlize() and we can wrap our $originalFilename in…
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…
Security & the User Class
…for now. We will add a password later, but we'll keep
things extra simple to start.
And... we're done! Awesome! This created a User entity, a Doctrine UserRepository
for it, and updated the security.yaml file.
Let's check out these changes next!
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…
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…
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…
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…
The POST Create API
…just
simpler if you can update the state immediately.
And that is why UUID's can be awesome. If you configure your Doctrine entities to
use UUID's instead of auto-increment ids, you can generate valid UUID's in JavaScript,
update the state immediately…
Finishing with kernel.response and kernel.exception
…After that, the
controller is called and the stuff under that is our work. We can see
some Doctrine calls we’re making and the time it takes to render the template.
After the controller, the kernel.response event is dispatched, it has
a few…
Listening to LemonSqueezy Javascript Events
…hit. So... did this work?
At your terminal, check the database with:
bin/console doctrine:query:sql "SELECT * FROM user"
It didn't! It says that the lsCustomerId value is "undefined". Hmmm, sounds
like we're using a bad path for the customer ID. If…
Upgrading to Symfony 6.0
…? We get
Attempted the load class QueryAdapter from namespace "Pagerfanta\Doctrine\ORM.
This shouldn't be a surprise... since we did upgrade pagerfanta-bundle from
2.8 to 3.6.
This is a situation where you need to find the GitHub page for the library…
Annotations to Attributes
…re back!
With just a few commands we've converted our entire site from annotations to
attributes. Woo!
Next, let's add property types to our entities. That's going to allow us to have
less entity config thanks to a new feature in Doctrine.
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.
x
1000+