Testing with the "in-memory" Transport
…find it.
This... is basically a fake transport. When a message is sent to it, it doesn't
handle it or send it anywhere, it stores it in a property. If you were to use this
in a real project, the messages would then disappear…
Abstracting a Class into 2 Smaller Pieces
…ShipLoader copy the entire queryForShips() and paste that
into fetchAllShipsData() and once again reference the pdo property:
Now we have a class whose only job is to query for ship stuff, we're not using it anywhere yet, but it's fully
ready to go…
Turbo Streams: Update any Element
…count:
Copy that. When we search on the page, it's actually this that's navigating.
So anywhere inside this - I'll go to the bottom - we can add a .
Say:
Linking to EasyAdmin from Twig
…I love it! We see the icons here... and if we go anywhere
else - like to an Answer's detail page - the icons are here too.
At this point, we know how to generate a link to any EasyAdminBundle page. If I
scroll up a…
Using the Filesystem
…configured
as a global bind. And when you configure a bind, it must be used in at least
one place in your app. If it's not used anywhere, you get this error. It's kinda nice: Symfony is saying:
Hey! You configured this bind…
BDD Features
…good. What else do we have? Check out the "Fence Security Activated" message on the site.
Let's imagine we need to create an API where someone can make an API request to turn the fence
security on or off from anywhere. For example, if…
Centralized Configuration
…$configVars in config.php:
// lib/config.php
$configVars = array(
);
This change looks safe. I mean, it’s not like we’re using this variable
anywhere inside this file. But when we refresh, things explode! We are
referencing the old $config variable inside get_pets…
Object-Oriented Intro: Classes and Objects
…including core
PHP functions like array_reverse() and our own like get_pets(). We
can call a function from anywhere in our code, so we say that they are available
“globally”.
But some functions aren’t global: they live inside an object and we call…
Configuring the Platform.sh Deploy
…stuff above or below.
The config has mounts - for directories that you want to keep persistent between
deploys - PHP extensions, your PHP version, and quite a bit more.
Anywhere inside, paste the dependencies line... and make sure it's not
indented.
And just like that…
Debugging
…have an invalid path, which could be
an invalid logical path in a template or an invalid relative path in some
import somewhere.
By the way, there's an almost hidden way to see if any invalid imports appear
anywhere in your code. First, run:
…
QR Data & Scanning with an Authenticator App
…log in - well, it matches one of the tokens in our configuration.
Specifically, we get the UsernamePasswordToken when we log in via the form_login
mechanism.
If we try going anywhere else on the site, it kicks us right back here. The
only place we…
2 Factor Authentication & Authentication Tokens
…do need to do.
Start by copying the two_factor stuff. Then open up
config/packages/security.yaml. This new config can live anywhere under our
main firewall. I'll paste it after form_login... and we can remove this
comment: it highlighted that 2fa…
Who Creates the Controller & Gives it the Container?
…they're the only services that we routinely make public.
If you look back at services.yaml, it's not immediately obvious why they're
public - I don't see a public: true anywhere. I'll save the details for the
next deep-dive tutorial…
Query Bus
… We're returning
a value from our handler! This is not something that we've done anywhere else.
Commands do work but don't return any value. A query doesn't really do any work,
its only point is to return a value.
Before we…
Absolute Asset Paths
…in one spot: by the uploaded_asset() Twig function. But, we're not actually
using this Twig function anywhere at the moment.
So try this: in the form, we're showing the thumbnail. It might be useful to allow
the user to click this and…
Flysystem <3 LiipImagineBundle
…we already have our Flysystem config all set up. Then, open our
liip_imagine.yaml file and, really, anywhere, paste!
This creates a loader called profile_photos - that name can be anything. Let's
use flysystem_loader. The critical part is the key flysystem: that…
Practicing BDD: Plan, then Build
…icon:
Other than some easy-win styling, I want to do as little work as possible to get
each step of the scenario to pass.
Refresh: there's the button. It doesn't go anywhere yet, try it:
This time, it did click "New Product…
Building a Login Scenario
…s run this!
It runs... and fails:
The text "Logout" was not found anywhere in the text of the current page.
I happen to know this is because the password is wrong. But let's pretend that
we didn't know that, and we're…
Querying for One Pet
…is to make it accessible anywhere by moving that stuff to a
new function called get_connection. Let’s do that:
function get_connection()
{
}
With variables, you have to worry about scope and what you have access to.
But functions can be called from anywhere…
Creating Functions
…comment
out lines in PHP. Anything on a line after // is ignored by PHP entirely.
This is handy for temporarily removing code or writing little love notes to
your fellow developers.
Our new function can live anywhere in this file, but let’s put it…
x
511