jQuery Plugins / Bootstrap
…! This
is where things get really interesting.
At this point, we're no longer using the global jQuery variable or Bootstrap
JavaScript anywhere: all of our code now uses proper require statements. To
celebrate, remove the two script tags from the base layout:
And now…
PHPUnit: Secure the Park
…failed asserting that false is true on
DinosaurTest line 11.
Ok, let's talk about the basic rules of writing a PHPUnit test. First, you can
technically put your test classes anywhere... but.. you've gotta admit that
tests/ is a pretty good place. Actually…
Installation and First Admin
…which we need
to import. Copy the routing import lines, find our app/config/routing.yml and
paste anywhere:
Since we already have some pages that live under /admin, let's change the prefix
to /easyadmin:
Finally, one last step: run the assets:install command…
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…
Handling 404 Errors
…JsonResponse and set the application/problem+json Content-Type
header on it. Now, if an exception is thrown from anywhere in the system
for a URL beginning with /api, the client will get back an API problem
response. It took a little bit of work…
ApiProblemException and Exception Handling
…notice that the status code
is still 400. Our new exception class extends HttpException, so we
really have the same behavior as before.
When an exception is thrown anywhere in our app, Silex catches it and gives
us an opportunity to process it. In fact…
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…
Routing: The URLs of the World
…pull it in. So, even though Symfony only reads this one
routing file, we can pull in routes from anywhere.
So what's up with the @EventBundle magic? The resource should just
point to the path of another file, relative to this one. But if…
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…
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…
x
512