517 search results

Redirecting the Full Page from a Frame

…you want to navigate the entire window to a confirmation page. So let's make our frame-redirecting system something that we can use anywhere. Here's the plan: if a turbo-frame - like the turbo-frame in _modal.html.twig - has a data-turbo…

5:14
Globally Disable Buttons on Form Submit

…form on our site by leveraging an event that Turbo dispatches. In your editor, open up assets/turbo/turbo-helper.js. Anywhere in the constructor, listen to a new event: document.addEventListener('turbo:submit-start'). Pass this an arrow function with an event argument. Inside…

5:50
Exception Handling

…about the unhappy path. Well, our entire application is wrapped in this try-catch block. So, if an exception is thrown from anywhere, this will catch it. The $catch argument is true by default, so we're not going to hit this finishRequest() line. Nope…

9:29
Microservices Gone Wrong

…it. How we built it. Where we ran into significant trouble, and where everything worked well. And this is my puppy Adda who's going to help me on some of these transitionary slides. So let's jump into the background. I walked in to…

39:20
The Drupal Console & Route Cache

…in your terminal. Next, move it into a global bin directory so that you can simply type drupal from anywhere in the terminal: Hello Drupal Console! Now try drupal list: This shows a huge list of all of the commands you can run. There is…

1:51
Embedding Custom DTO's

…as a custom array of embedded data? Check it out. In the src/ApiResource/ directory, though this class could live anywhere, create a new class called DailyQuestTreasure. This will represent the treasure that you could win by completing a DailyQuest. Inside, create a public function _…

4:47
Dependency Injection

…That's true. But, you can't just grab them out of thin air from anywhere in your code. For example, there's no Cache::get() static method that you can call whenever you want that will return the $cache service object. Nothing like that…

9:34
Custom Transport Serializer

…your transport. Creating a custom serializer is... actually a very pleasant experience. Inside of our src/Messenger/ directory... though this class could live anywhere.. let's create a new PHP class called ExternalJsonMessengerSerializer. The only rule is that this needs to implement SerializerInterface. But, careful…

6:33
Registering & Autoloading a Custom Matcher

…reuse them across multiple spec files - that's a bummer. Fortunately, phpspec is awesome and so - of course - it does have a way to create a matcher that can be used anywhere. And... what's even better is that there are a lot of great…

5:26
Array, Set and ES2016

…loads, we call loadRepLogs(): This fetches an array of repLog data via AJAX and then calls _addRow() on each to add the elements to the table. But once we add the table rows... we don't actually store those repLog objects anywhere. Yep, we…

6:31
Using Objects and Array Keys

…print the title, just say pageData.title. To print the summary, use the same trick! This can be used anywhere, like in an if statement in exactly the same way: So if you ever need data from an array, the . operator is your answer! The…

3:26
Setting the UUID on POST

…be ignored. How can I be so sure? Well, look at the User class: $uuid is not settable anywhere. It's not an argument to the constructor and there's no setUuid() method: Time to change that! Let's describe the behavior we want in…

5:15
Completely Custom Resource

…really, an API resource can be any object that pulls data from... anywhere! So instead of adding un-persisted $isMe and $isMvp fields to User: We could have created a totally different non-entity class - like UserApiResource - with exactly the fields in our API. And…

5:25
Data Persister Decoration

…that object. Usually, this means that we're saving an entity object to the database via Doctrine. But we could "save" an object anywhere, like by sending the data to another API, or putting it into Redis or ElasticSearch. ApiPlatform doesn't really care. These…

6:48
Head first into Symfony Cache, Redis & Redis Cluster (Andre Rømcke)

…placement in your system for your entities, variant type in commerce systems maybe. So a lot of different things depending on your system. And where this is relevant is if you have operations in your application that affects, uh, quite a big subset of those…

37:44
Fetching the User In a Service

…built a long time ago, like 3 screencasts ago. Click on any article. Then, click anywhere on the web debug toolbar to open the profiler. Find the "Logs" section and click on "Info & Errors". There it is! They are talking about bacon again! This is…

4:37
Customizing Errors & Logout

…use usernames!? That's... confusing. There are two ways to control these error messages. The first is by throwing a very special exception class from anywhere in your authenticator. It's called CustomUserMessageAuthenticationException. When you do this, you can create your own message. We'll…

6:35
Bonus! LoggerTrait & Setter Injection

…take that code and move it into its own service class. Since this is such an important skill, let's do it: in the Service/ directory - though we could put this anywhere - create a new class: SlackClient: Give it a public function called, how about…

8:32
Symfony 4: Let's Launch!

…excited. Why? Because nothing makes me happier than sitting down to work inside a framework where coding is actually fun, and where I can build features fast, but without sacrificing quality. Well, maybe I'd be even happier doing all of that on a beach..…

4:03
Clearing the Database

…In a Symfony 4 Flex application, you should create a config/packages/test/doctrine.yaml file since this will contain Doctrine configuration that you only want to use in the test environment. Inside, anywhere, add doctrine, dbal then url set to sqlite:///%kernel.project_dir…

6:19