Welcome Guest, Not a member yet? Register   Sign In
resultset Model Error
#3

(02-08-2021, 01:36 PM)iRedds Wrote: Error?
1. You have set Entity to return result
2. You are using findAll() method (returns an array of results)

There is no error here.


this is my entity:

PHP Code:
<?php
namespace App\Models\Entities;

use 
CodeIgniter\Entity;
use 
App\Models\IseeModel;

class 
Isee_documenti_documenti_dichiarante_Entity extends Entity
{
    function isee()
    {
      $model= new IseeModel();
      return $model->find($this->id_isee);
    
    
}



and this is my model :

PHP Code:
<?php

namespace App\Models;

use 
CodeIgniter\Model;


class 
Isee_documenti_documenti_dichiaranteModel extends Model {

   protected $table 'isee_documenti_documenti_dichiarante';
    protected $primaryKey 'id';

    protected $returnType 'App\Models\Entities\Isee_documenti_documenti_dichiarante_Entity';
    protected $useSoftDeletes true;

    protected $allowedFields = ['id','id_isee','nome_file','id_div','created_at','updated_at','deleted_at'];
    protected $useTimestamps true;
    protected $createdField 'created_at';
    protected $updatedField 'updated_at';
    protected $deletedField 'deleted_at';

    protected $validationRules = [];
    protected $validationMessages = [];
    protected $skipValidation false;

    
  function oggetto_di_user($user_id,$id)
    
  {
        
$this->where('id_users',$user_id);
        
$this->where('id ',$id);

                $res=$this->findAll();

                if($this->countAllResults()==0){
        
  return TRUE;
        }else{
        
  return FALSE;
        }
    
  }



    public function value_unique_on_update($id,$value){

        $this->where('value',$value);
        $this->where('id !=',$id);

        

        
if($this->countAllResults()==0){
          return TRUE;
        }else{
          return FALSE;
        }

    }



but in other project not return this result but only multidimensional array
Reply


Messages In This Thread
resultset Model Error - by pippuccio76 - 02-08-2021, 11:51 AM
RE: resultset Model Error - by iRedds - 02-08-2021, 01:36 PM
RE: resultset Model Error - by pippuccio76 - 02-08-2021, 02:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB