517 search results

Denying Access in a Controller

…it lives in AbstractController. This method is so beautifully boring: it creates and returns a new AccessDeniedException. This exception is the key to denying access, and you could throw it from anywhere in your code. Close that... and then go refresh. Yup, we get the…

4:57
When Authentication Fails

…to your users - you can do this. Open up config/packages/security.yaml. And, anywhere under the root security key, add a hide_user_not_found option set to false: This tells Symfony to not convert UserNotFoundException to a BadCredentialsException. If we refresh now... boom…

7:19
Current Product Id

…read this in a Vue component? Well... it's a global variable... so we could put window.currentProductId anywhere. But in the last tutorial, we started centralizing these global variables into a services/page-context.js file. As a reminder, services/ is a directory that…

4:56
Parameters

…the container. Invent a new one called, how about, cache_adapter set to cache.adapter.apcu: There should now be a new parameter in the container called cache_adapter. We're not using it anywhere... but it should exist. How do we use it? There…

7:59
Creating a Service

…which we will later. So how do we create our very own service? Start by creating a class anywhere in src/. It doesn't matter where but I'll create a new sub-directory called Service/, which I often use when I can't think…

5:03
Adding a Watcher

…we didn't need it! All we needed to do - when onSearchProducts() was called - was use the term to immediately load the products. There was no need to store the search term anywhere for later. But now we do have a need! We do need…

5:13
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…

4:15
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…

4:47
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={…

5:07
Using the Filesystem

…configured as a global bind. And when you configure a bind, it must be used in at least one place in your app. If it's not used anywhere, you get this error. It's kinda nice: Symfony is saying: Hey! You configured this bind…

4:11
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…

5:10
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…

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

10:44
Setting up with the Symfony Local Web Server

…anywhere, I'll move this into a global bin directory. By the way, you only need to do these steps once on your computer... so you're done forever! Unless we've mucked things up, we should now be able to run this from anywhere…

5:15
Flex Extras

…new version, your fixtures are services, and so they act like everything else. You can even put them anywhere. When Composer finishes, download one more package: composer require fzaninotto/faker This isn't needed by DoctrineFixturesBundle, but we are going to use it. In fact…

6:31
Deploying Keys & Private Repos

…that public key. Actually, none of this is special to git, this is how SSH key-based authentication works anywhere. Even though our repository is still public, you need some valid SSH key pair in order to authenticate... and our server has nothing. That's…

8:40
Setup: Server Provisioning

…In our Ansible tutorial, we created a small playbook - aws.yml - whose only job is to boot an EC2 instance using an Ubuntu 14.04 image. You're free to get a server from anywhere... but if you do want to use this script to…

8:38
Autowiring Controller Arguments

…>get() call that does not work with private services. Celebrate by removing the first alias! The rest are easy! The app.markdown_extension id isn't referenced anywhere, so remove that. The app.security.login_form_authenticator is used in two places: security.yml and…

6:20
Skipping Tasks based on Changed

…add when: code_changed: Ah, so nice. Copy that and put it anywhere else it makes sense like "Execute migrations" and "Clear Cache": Phew! Ok, run the playbook - but take off the verbose flag: ansible-playbook ansible/playbook.yml -i ansible/hosts.ini -t deploy…

3:01
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…

7:23