index.php to HttpKernel::handle()
…a try catch! That's not important yet. But later, we'll
see what happens when an exception is thrown from anywhere.
The real logic of HttpKernel lives in this handleRaw() method. Scroll down
a little to find it. Ah yes: handleRaw(). This is the…
Storing Private Files
…Open the
config/packages/oneup_flysystem.yaml file. Copy the public_uploads_adapter, paste
and call it private_uploads_adapter. You can store the files anywhere, as long
as it's not in public/. But, the var/ directory is sort of meant for this type…
The Drupal Console & Route Cache
…in your terminal. Next, move
it into a global bin directory so that you can simply type drupal from anywhere
in the terminal:
Hello Drupal Console! Now try drupal list:
This shows a huge list of all of the commands you can run. There is…
More on Routing And Dependency Injection Parameters
…starting in Symfony 2.1, you can use a dependency injection parameter
anywhere in your routing.
First, let’s start with a normal route:
# app/config/routing.yml
# ...
parameter_test:
The goal is to move the /are/you/a/robot part out of our code…
Registering & Autoloading a Custom Matcher
…reuse them across multiple spec
files - that's a bummer. Fortunately, phpspec is awesome and so - of course - it does
have a way to create a matcher that can be used anywhere. And... what's
even better is that there are a lot of great…
Back to the Basics (Symfony local Web Server)
…logs, especially for the production environments
and there's some kind of a problem I need to debug the problem, it's kind of
hard to figure out where the problem is and where you got your exception. So
here we make it very clear…
Processing Streams by Hand for Fun & Profit
…then
the HTML is passed to the Turbo Stream system... and it works its magic. But in
theory, you could grab some Turbo Stream HTML from anywhere and tell the Stream
system to process it. And... it's kind of fun!
Head to the homepage…
Exception Handling
…about the unhappy path. Well, our
entire application is wrapped in this try-catch block. So, if an exception
is thrown from anywhere, this will catch it. The $catch argument is true
by default, so we're not going to hit this finishRequest() line. Nope…
Using Objects and Array Keys
…print the title, just
say pageData.title. To print the summary, use the same trick!
This can be used anywhere, like in an if statement in exactly the same way:
So if you ever need data from an array, the . operator is your answer!
The…
Customizing Errors & Logout
…use usernames!? That's... confusing.
There are two ways to control these error messages. The first is by throwing
a very special exception class from anywhere in your authenticator. It's called
CustomUserMessageAuthenticationException. When you do this, you can create your
own message. We'll…
Fetching the User In a Service
…built a long time
ago, like 3 screencasts ago. Click on any article. Then, click anywhere on the
web debug toolbar to open the profiler. Find the "Logs" section and click on
"Info & Errors". There it is!
They are talking about bacon again!
This is…
Configuring the Encoder in security.yml
…me how you want to encode the passwords. I can't
read your mind - I'm just a PHP framework.
Remember how I kept saying we would encrypt the passwords with bcrypt? Do you remember
actually configuring that anywhere? Nope! We need to do that.…
Keeping Problem types Consistent
…t want to mess up the title. Heck, I don't even
want to have to write the title anywhere - can't it be guessed based on the type?
I think so - let's just create a map from the type, to its associated title…
Custom Block View
…definition. Then we're going to map that to a template via block_views.
For step 1, open our netgen_layouts.yaml file and, really anywhere, add
block_definitions. This config can be used to create totally new blocks or
change options on existing blocks…
Contentful: Loading Data from an External CMS
…what we're doing, it's a pretty quick process and would give us a
lot of power on our site.
But one of the beautiful things about Layouts is that our value types can come from
anywhere: a Doctrine Entity, data on an external…
Redirecting the Full Page from a Frame
…you
want to navigate the entire window to a confirmation page.
So let's make our frame-redirecting system something that we can use anywhere.
Here's the plan: if a turbo-frame - like the turbo-frame in _modal.html.twig -
has a data-turbo…
Globally Disable Buttons on Form Submit
…form on our site by leveraging an event that Turbo dispatches.
In your editor, open up assets/turbo/turbo-helper.js. Anywhere in the constructor,
listen to a new event: document.addEventListener('turbo:submit-start'). Pass this
an arrow function with an event argument. Inside…
RAD with Symfony 3.3
…the goal: create an event listener that adds a header to every response.
Step 1: create an EventSubscriber directory - though this could live anywhere -
and a file inside called AddNiceHeaderEventSubscriber:
Event subscribers always look the same: they must implement EventSubscriberInterface:
I'll go to the…
Making all Services Private
…making this change is safe! We just created all of these service ids
a minute ago and they're not being used anywhere yet, definitely not with $container->get().
The exception is the last two services: we might be fetching these services directly
from the…