Welcome Guest, Not a member yet? Register   Sign In
Problem with Model()->find() and Model()->findAll()
#11

(10-06-2019, 12:03 PM)workoverflow Wrote: Hi! I have faced with problem with Model()->find() and Model()->findAll(). If i call ones of this methods i get null. It's doesn't work after update to 4.0.0-rc.2.1 with composer.

Hi guys, I have the same problem.
I'm using CI v4.0.0-rc.3 and couldn't get results using find() and findAll() methods.

Just two simple files.

Product model:
PHP Code:
<?php namespace App\Models;

use 
CodeIgniter\Model;

class 
Product extends Model
{
    protected 
$table 'products';
    protected 
$primaryKey 'ID';


Catalog controller:
PHP Code:
<?php namespace App\Controllers;

use 
CodeIgniter\Controller;
use 
App\Models\Product;

class 
Catalog extends Controller
{
    public function 
product(string $ID '')
    {
        
$productModel = new Product();
        
// working
        
$product $productModel->where('ID'$ID)->get()->getRowArray();
        
d($product);

        
// not working
        
$product $this->productModel->find($ID);
        
d($product);
    }


Could you help me in fixing it?
Thanks for your support.
Reply


Messages In This Thread
RE: Problem with Model()->find() and Model()->findAll() - by RobT - 10-30-2019, 02:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB