Welcome Guest, Not a member yet? Register   Sign In
potentially polymorphic call with model instance inside model function
#1

(This post was last modified: 10-31-2022, 12:54 AM by objecttothis. Edit Reason: word choice )

I'm porting a CI3 app to CI4 and need to call one model method inside another model method.  Can someone tell me why this produces no warning:

PHP Code:
public function get_value(): int
 
{
 
$this->sale model('Sale');
 return 
$this->sale->get_quote_number_for_year();
 }


But if I do this:

PHP Code:
public function get_value(): int
 
{
 
$sale model('Sale');
 return 
$sale->get_quote_number_for_year();
 }


I get a warning from PhpStorm
Potentially polymorphic call. Model does not have members in its hierarchy

The function signature for get_quote_number_for_year() is
public function Sale::get_quote_number_for_year($year = '', $start_from = 0) int
Reply


Messages In This Thread
potentially polymorphic call with model instance inside model function - by objecttothis - 10-31-2022, 12:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB