Here’s how to see the native SQL or raw SQL generated by Yii queries. The easy way is to open the debug area and click on the DB tab. Recently, I was debugging complex SQL queries for background tasks and wanted to see the raw SQL generated. The debugger isn’t as easily available. I used […]
If you need to perform a Regex search for unused language strings or use replace to activate them again in Atom, there’s a fairly easy way to do this. You will need to turn on Regex search in the find dialog by clicking the .* button: For search, I used (.+) to find strings in between […]
I also very much liked Social Buttons for Bootstrap. You just include their CSS and they show you how to create icons and buttons: <a class=”btn btn-block btn-social btn-twitter”> <span class=”fa fa-twitter”></span> Sign in with Twitter </a>
Need to know the current UNIX timestamp? I think my new favorite helper site is currenttimestamp.com. I was writing a ton of time sensitive code for background jobs and it helped to know the current UNIX time for testing. Here’s what the site offers:
After my new production server installation, I discovered I couldn’t run migrations: $ ./yii migrate/up bash: ./yii: Permission denied Adding execution permissions to ./yii resolved the problem: $ chmod +x ./yii deploy@apps:/var/www/mp$ ./yii migrate/up Yii Migration Tool (based on Yii v2.0.8) No new migrations found. Your system is up-to-date. Found via this comment.
If you’re running into a near empty screen showing, “An internal server error occurred” in Yii2, check your error logs. It’s a simple fix. My logs showed: An Error occurred while handling another error:\nexception ‘yii\\base\\InvalidConfigException’ with message ‘The directory is not writable by the Web process: /var/www/mp/backend/web/assets’ in /var/www/mp/vendor/yiisoft/yii2/web/AssetManager.php:213 You can resolve it by opening […]
If you’re editing a file in Atom, the command to reveal the file in the sidebar is: Command + Shift + \ I’ve recently switched to Atom and very much appreciate it as an emerging power editor on the MacOS platform.
If you’ve been getting the error below: The “yiisoft/yii2-composer” plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example). I’ll try to help you fix it with this blog post. Increasingly, I’m fatiguing of the frequent composer errors that require regular reconfiguration. While you have to […]
The Krajee Switch Input widget for Yii2 based on Bootstrap Switch is great. I’ll write more about it in the near future. However, I had one major problem with a gap in the documentation – others seem to have been confused as well. When you’re using the widget in SwitchInput::RADIO mode, it’s not well documented […]
Let’s say you’re using a validator that doesn’t correspond to a specific field and you want to display it on the form. For example, I’m using the compare validator and wish the error summary to appear on the create form. [php] <?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model frontend\models\Participant */ […]