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…
API Platform Installation!
…fake" library that helps install several thing at once.
Heck, you can see this at https://github.com/api-platform/api-pack: it's a single
composer.json file that requires several libraries, like Doctrine, a CORS
bundle that we'll talk about later, annotations…
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…
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…
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…
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…
Serializing Messages as JSON
…the keys that you're allowed to have below each transport is called
serializer. Set this to a special string: messenger.transport.symfony_serializer.
When a message is sent to a transport - whether that's Doctrine, AMQP or something
else - it uses a "serializer" to…
Search, the Request Object & OR Query Logic
…we were already
filtering WHERE status = approved. But because we put the OR statement inside
of the andWhere(), Doctrine surrounded the entire fuzzy search part with parentheses.
If we had used orWhere(), that wouldn't have happened... and our query logic
would have been…
Removing Items from a Collection
…the $cheeseListings
property, add orphanRemoval=true.
This means, if any of the CheeseListings in this array suddenly... are not
in this array, Doctrine will delete them. Just, realize that if you try to
reassign a CheeseListing to another User, it will still delete that
CheeseListing. So…
@SerializedName & Constructor Args
…Symfony 4.3, you may already see a validation error!
That's because of a new feature that can automatically convert your database
rules - the fact that we've told Doctrine that title is required in the
database - into validation rules. Fun fact, this feature…
Serialization Groups
…false.
By the way, if you're using Symfony 4.3, instead of a Doctrine error, you may
have gotten a validation error. That's due to a new feature where Doctrine database
constraints can automatically be used to add validation. So, if you see…
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…
Pushing & Pulling Translations
…We'll need to rely on a third-party
solution for that. A popular one is this
Doctrine Extensions package.
It has a "Translatable" behavior
that allows you to translate your entities. There's also a
Symfony Bundle
to wire it all up.
It works…
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…
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…
Database Tricks on SymfonyCloud
…main php bin/console doctrine:fixtures:load
Ok, let's break this down. First, there is actually a much easier way to do all
of this... but I'll save that for some future SymfonyCloud tutorial. Basically,
we're running the doctrine:fixtures:load command…
Flysystem & S3
…it should... just kinda work! The easiest way to find out is to reload
the fixtures:
php bin/console doctrine:fixtures:load
And yes, I do recommend using S3 when developing locally if that's what you're
using on production. You could change the…
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…
Idempotency, changed_when & Facts
…and paste that below:
So what language happens when there are no migrations to execute? Go to your virtual
machine and run the migrations to find out:
./bin/console doctrine:migrations:migrate --no-interaction
Yes! It says:
No migrations to execute
That's the key…
Themed Pagination Links
…cool!
Ok team! Congratulations on finishing both Doctrine courses! Big team high five!
Doctrine is one of the most important parts of Symfony and it will unlock you
for almost anything else you do. So let us know what cool stuff you're building
and…
x
1000+