Welcome Guest, Not a member yet? Register   Sign In
validation error
#1

Code:
I am having an error "Call to a member function setRules() on null"

Call to a member function setRules() on null
Code:
SYSTEMPATH/BaseModel.php at line 1421
Code:
return $this->validation->setRules($rules, $this->validationMessages)->run($data, null, $this->DBGroup);


BaseModel.php
<?php
namespace App\Models;
use CodeIgniter\Model;


class BaseModel extends Model
{
    public $db;
    public function __construct()
    {
        $this->db = db_connect();
        $this->db->setPrefix('fdev_');
    }
}

<?php
namespace App\Models;

CustomersModel.php
class CustomersModel extends BaseModel
{
    protected $table = 'customers';
    protected $primaryKey = 'id';
    protected $useAutoIncrement = true;
    protected $allowedFields = [
        'company_name',
    ];
    protected $beforeInsert = ['beforeInsert'];
    protected $afterInsert = ['afterInsert'];
    protected $beforeUpdate = ['beforeUpdate'];
    protected $afterUpdate = ['afterUpdate'];
    protected $useTimestamps = true;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';
    protected $deletedField  = 'deleted_at';
    protected $validationRules    = [
        'company_name' => 'required',
    ];
    protected $validationMessages = [];
    protected $skipValidation     = false;
Reply


Messages In This Thread
validation error - by fdev - 03-22-2021, 06:54 PM
RE: validation error - by InsiteFX - 03-23-2021, 03:41 AM
RE: validation error - by paulbalandan - 03-26-2021, 07:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB