Calling the Controller & View Event
…entity! You would return a "model". Then, you could write a listener
to this event that transforms that Article entity into HTML by rendering the template.
This event isn't used anywhere in Symfony's core, but it is used extensively
inside API Platform. Internally…
Blackfire Player
…on this link, and so on. It can get fancier, but that's
the gist of it.
Let's create a our first Blackfire player file at the root of the project, though
it could live anywhere. Call it, how about, scenario.bkf. That's…
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…
Support any Browser with PostCSS & Babel
…amazing... let's add it! In webpack.config.js, anywhere,
but how about below .enableSassLoader(), add .enablePostCssLoader():
PostCSS is a library that allows you to run things at the "end" of your CSS being
processed. And it's the easiest way to integrate autoprefixer.
Next…
Edit Endpoint & Deserialization
…Keep the same URL, but change the route name
to admin_article_update_reference - it should be reference, not references,
let's fix that in both places - I don't think I'm referencing that route name
anywhere. And instead of methods={"DELETE"}, use methods={…
Reordering the Files
…nicer. Pass a second argument to create():
an array of options. Pass one called handle set to .drag-handle.
With this, instead of being able to grab anywhere to start sorting, we'll only
be able to grab elements with this class. Down in render…
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…
Extensions, php.ini & lineinfile
…item. That works
because Ansible has this nice with_items loop feature. And notice, this is not
special to the apt module - it'll work anywhere.
Oh, and those quotes are important:
Quoting is usually optional in YAML. But if a value starts with {{, it…
PHP 7, Nginx & MySQL
…mootube.l from our host machine.
To handle that, head to your terminal on your main machine - so not the VM - and
edit your /etc/hosts file. Inside, anywhere, add 192.168.33.10 mootube.l. Save
that!
Back at the browser test it: http…
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…
Creating a new Symfony 5 Project
…downloads a single executable file and, for me, puts it into my home directory.
To make it so that I can run this executable from anywhere on my system, I'll
follow the command's advice and move the file somewhere else:
Ok, try it…
Exposing more Error Details
…Look back at our exception-handling
function. The NotFoundHttpException is not an instance of ApiProblemException,
so we fall into the situation where we create the ApiProblem by hand.
We’re not using the exception’s message anywhere, so it makes sense we don’t
see…
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…
How to handle dynamic Subdomains in Symfony
…this be handled? Let’s find out together!
1) The VirtualHost¶
Before you go anywhere, make sure you have an Apache VirtualHost or Nginx
site that sends all the subdomains of your host to your application. Since
we’re using lolnimals.l locally, we’ll…
Injecting Config & Services and using Interfaces
…if we needed to use the mailer object somewhere else
in our app? Right now, we would need to create it anywhere we need it, since
it's buried inside FriendHarvester.
In fact, FriendHarvester doesn't really care how we're sending emails,
it only…
FlattenException & Error Status Codes
…which will be a 412 and many more.
Hmm, where's the IAmATeaPotHttpException?
If you throw any of these exceptions from anywhere in your app, they will trigger
an error page with the correct status code. This is a powerful thing to understand.
Back in…
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…
Sub Request Attributes
…argument. If we try, I want
an exception to be thrown.
By the way, it is actually possible to use the RequestStack from anywhere
to get the "master" request: it has a getMasterRequest() method. But! If
you're using HTTP caching with edge side includes…
Blackfire Environment Variables
…it will assert that the wall time is less
than 100ms times whatever this speed_coefficient variable is. What is
speed_coefficient? It's totally something I just made up and it is not set
anywhere. Where do we set it? Inside our Blackfire environment…
x
512