Error PHP

hello

i have a table cliente , and cliente have 1 one cidade, and cidade have many cliente…
$cidade area a value of

if $cidade are equals 0 , cidade are not selected.

$cliente = ClienteFactory::createCliente();
if ($cidade > 0) {
$cidadee = CidadeFactory::loadCidadeByORMID($cidade);
// object cidade
$cliente->cidade = $cidadee;
}
		
		$cliente->nome = $nome;
		$cliente->email = $email;
		$cliente->telefone = $telefone;
		$cliente->login = $login;
		$cliente->senha = $password;
		$cliente->save();

i have problem:

Fatal error: Call to a member function epGetObjectId() on a non-object in D:\workPHP\alianza\lib\phporm\src\db\epDbObject.php on line 2920

tanks

Hello Hussan,

Your problem probably caused by the cidade ID cannot be null on cliente table, but the load statement are not able to load the cidade to model. You can change the cidade ID to nullable in model and re-generate code & DB for solving this problem. If you have any further inquiries, please do not hesitate to contact me again.

Best regards,
Rain Wong