Much of the work done with models involves using the methods defined within the model classes. These methods, such as rules() and relations(), are created by the code generator Gii. You’ll also add your own methods to the code generated for you. But, thanks to inheritance, there are lots of methods common to Yii models that you’ll frequently use. In this post, I want to specifically look at methods used to handle model-related events. Before looking at the usage of these methods, let’s first look at event handling in Yii in general.
Continue Reading...Archives For PHP
Over the weekend, I posted an update to “The Yii Book”. This is version 0.5, which means I’m halfway there (about the time I was hoping to have the book done; so much for good intentions). With that in mind, my sincerest thanks to everyone for their patience. I know this is taking longer than we’d all like, but I’m doing my best and very much appreciate the understanding on your part. It’ll get done, I promise. And trust that “The Yii Book” is not taking a back seat to anything as far as my work goes these days.
Continue Reading...A topic critical to controllers, although not dictated within the actual controller code are routes. Routes are how URLs map to the controller and action to be invoked. Chapter 3, “A Manual for Your Yii Site,” introduced the basic concept and Chapter 4 explained how to configure the “urlManager” component to change how routes are formatted. Let’s now look at the topic in greater detail.
NOTE: This is an excerpt from Chapter 7, “Working with Controllers,” of “The Yii Book”.
Continue Reading...To wrap things up on my eight-part series on processing payments with Stripe, I’ll mention a few random things under the guise of testing and tricks. Most of the information will only make sense if you already understand how processing payments with Stripe works (i.e., if you’ve read the entire series).
Continue Reading...It’s the beginning of a new year, which makes it an apt time to talk about resolutions. But I’m not really a resolutions kind of person. Instead of resolutions, I prefer goals, specifically work goals. (And by “prefer”, I mean that it’s something I’ve finally started purposefully thinking about in the past couple of years.) I often get asked about what kinds of things developers should learn, so a good portion of this newsletter will be goals you could set towards that end. You’ll also find links to my 2013 goals, and a recap of how well my 2012 resolutions, er, goals, were met.
Continue Reading...