Forum

Kohana: ErrorExcept...
 
Notifications
Clear all

Kohana: ErrorException [ 0 ]: count(): Argument #1 ($value) must be of type Countable|array, Model_ given

1 Posty
1 Users
0 Reactions
403 Widok
0
Topic starter

error kohana

1 Answer
0
Topic starter
  1. edit modules/orm/classes/Kohana/ORM.php
  2. find
    	public function has($alias, $far_keys = NULL)
    	{
    		$count = $this->count_relations($alias, $far_keys);
    		if ($far_keys === NULL)
    		{
    			return (bool) $count;
    		}
    		else
    		{
    			return $count === count($far_keys);
    		}
    	}

    3. relace with

  3. 	public function has($alias, $far_keys = NULL)
    	{
    		$count = $this->count_relations($alias, $far_keys);
    		if ($far_keys === NULL)
    		{
    			return (bool) $count;
    		}
    		else
    		{
                if (is_array($far_keys) OR $far_keys instanceof Countable)
                {
                    $keys = count($far_keys);
                }
                else
                {
                    $keys = 1;
                }
    
                return $keys === $count;
    		}
    	}

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: