517 search results

Ajax Element Reloading Controller

…an Ajax call to reload the product list area after a new product is successfully added. To be extra cool - cause we are extra cool - we're going to make this new controller generic so we can reuse it anywhere... like on the cart page…

6:23
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…

8:04
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…

5:20
Annotations

…bring up all the options that you have in that spot. In fact, "control+space" can be used pretty much anywhere to show you your auto-complete option - really handy. This autocomplete works for two reasons. First, an annotation represents a real class. Hold command…

2:47
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…

11:43
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:

5:23
Custom Entity Methods & Twig Magic

…the vote count. Pass these in: $prefix then the absolute value of $this->votes... since we're adding the negative sign in manually. We can now use this nice method anywhere in our app... like from inside a template with mix.getVotesString(). Or shorten this…

7:46
Publish-Subscriber (PubSub)

…constructor arguments... it's just not something I care about all that much. It does look cool though. Down here, anywhere before our app actually starts, say $this->eventDispatcher->. Notice that the only method this has is dispatch(). I made a... tiny mistake. Let…

6:18
Review this Product... in a turbo-frame!

…we submit... gorgeous! Our new review even popped up right above the form! Though, hmm. There's no success message anywhere on the page. There was one before... but now it's gone! What happened? Look back at the network tools. There are two new…

7:50
Using a Full HTML Page to Populate a Frame

…In base.html.twig, scroll back down to that area. Surround this in a new {% block weather_widget %} and, on the other side, {% endblock %}. Back in index.html.twig, anywhere, override that block... but make it empty. Ok, refresh again and... cool! At this point…

7:24
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…

6:10
SRP: Responsibilities

…code that deals with hashing passwords and persisting user data? In a perfect world, shouldn't I be able to create this "email resend" feature without going anywhere near code that's unrelated to this functionality? This is what SRP is trying to help us…

6:24
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…

6:00
Auto-Provide jQuery for Mischievous Packages

…is already scanning all of our code. When you enable this feature, each time it finds a jQuery or $ variable- anywhere in any of the code that we use - that is uninitialized, it replaces it with require('jquery'). It basically rewrites the broken code…

6:37
Page-Specific JS: Multiple Entries

…that we have this new article_show entry, inside show.html.twig, instead of our manual