PHP code example of jzfpost / yii2-dynamicfinder
1. Go to this page and download the library: Download jzfpost/yii2-dynamicfinder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jzfpost / yii2-dynamicfinder example snippets
use jzfpost\dynamicfinder\DynamicFinderTrait;
class Customer extends \yii\db\ActiveRecord
{
use DynamicFinderTrait;
your code...
}
$model = Customer::findOneByEmail($email); // return Customer::find()->where(['email' => $email])->one();
$customers = Customer::findAllByEmail($email); // return Customer::find()->where(['email' => $email])->all();
$count = Customer::findCountByEmail($email); // return Customer::find()->where(['email' => $email])->count();
$username = Customer::findUsernameByEmail($email); // return username value where email=$email;
$updatedAt = Customer::findUpdatedAtByEmailOrUsername($email, $username); // return updated_at value where email=$email or username = $username;
$createdAt = Customer::findCreatedAtByEmailAndUsername($email, $username); // return created_at value where email=$email and username = $username;
$customers = Customer::findByEmail($email) equivalently Customer::findAllByEmail($email);
php composer.phar