Child Component
…answer that, there is technically another option: we could just
move the highlightedRowId state into the RepLogList component. And, technically,
this would work! Look closely: RepLogApp isn't using that data anywhere else! So
if we moved the state, everything would work!
But... for a…
Users Need Passwords (plainPassword)
…little evil.
Finally, in eraseCredentials(), add $this->plainPassword = null:
Symfony calls this after logging in, and it's just a minor security measure to prevent
the plain-text password from being accidentally saved anywhere.
The User object is perfect. Let's add the listener.
The Form Type Class
…in the new GenusAdminController.
To create a form, you'll add a class where you'll describe what the form
looks like.
In PhpStorm, select anywhere in your bundle and press command+N, or right click
and select "New". Find "Form" and call it GenusFormType…
Creating a Service Class
…click one of the genuses. Yes!
The fun fact is screaming at us in upper case.
So believe it or not: you just saw one of the most important and commonly-confusing
object-oriented strategies that exist anywhere... in any language! And it's this…
dotenv: Environmental Variables
…Because of config.yml,
this should turn the toolbar off. Change the environment to prod too - that's not
being used anywhere yet, but it may avoid a temporary cache error:
Try it out: no web debug toolbar.
Add .env to the .gitignore file - this…
AppBundle, Routing and Annotations
…some comments to make things really small. This includes the normal
autoloader, then adds an extra thing for annotations. Now, in index.php - or anywhere
else you need to autoload - require this file instead:
Refresh! Very nice! Let's count the files: 1, 2, 3…
The All-Important HttpExceptionInterface
…error, unless
that exception implements the HttpExceptionInterface:
It has two functions: getStatusCode() and getHeaders(). The HttpException class
we're throwing implements this. That means we can throw this from anywhere in our
code, stop the flow, but control the status code of the response. Symfony…
Mad Test Debugging
…is really easy. The class that handles the
styling is called ConsoleOutput, and you can use it directly from anywhere.
Start by adding a private $output property that we'll use to avoid creating
a bunch of these objects. Then down in printDebug(), say
if…
Deployment
…under a branch called episode4-finish.
Let’s clone this repository:
git clone
Move into the directory. If your code lives anywhere other than the master
branch, you’ll need to switch to that branch:
git checkout -b episode4-finish origin/episode4-finish
GitHub might…
Remember Me Functionality
…our session cookie to make sure it’s working. When I refresh,
my session is gone but I’m still logged in. Nice! Click anywhere on the web
debug toolbar to get into the profiler. Next, click on the “Logs” tab. If
you look closely…
Downloading & Configuration
…that didn't work. So let's try pasting the command instead. If you
have PHP 5.4 installed, run this anywhere: we'll use PHP's built-in web server.
If you don't, get with it! PHP 5.3 is ancient. But anyways…
Gherkin
…while vacationing thousands of miles away.
Feature: Remote fence control API
In order to control fence security from anywhere
As an API user
I need to be able to POST JSON instructions that turn fences on/off
The person benefiting in this case is our…
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:
…
Mapping Assets
…how about, templates/base.html.twig. Anywhere - I'll go above the
body block - add an img with src="{{ asset() }}" passing this the path to
our file relative to the assets/ directory. So images/penguin.png.
That's it. This is known as the "logical…
Block Views & Block Definitions
…the newest first and limit to 3.
Ok, if we "Publish and continue editing"... then refresh... whoa! It's cool that
we can just put those anywhere now. Though, let's wrap that in a container. And...
much better.
So far, this is all easy…
Shared Layouts
…new layout, I'll choose my favorite layout 2 and call it
"Recipes List Layout". To start, add a new block called "Full View"... and drag it
anywhere onto the page, whoops! There we go.
What is this "Full View". It's nothing special, in…
Item View Template
…our recipe item:
Next, add recipes_app... with a little note to say that this key is not important:
Unlike other things, such as latest_recipes, this internal key won't be used
anywhere. Below, we need two important things. First, template - don't include…
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…
x
517