Code:
protected function saveProcess(\Lala\Entity\Country $country)
{
$form = $this->formAction();
$input = $this->filter([
'country_id' => 'uint',
'country_name' => 'str',
'country_saison' => 'str',
'display_order' => 'uint',
]);
$form->basicEntitySave($country, $input);
return $form;
}
Without any unique fields this code is the usual one and perfect.
But now i have changed
country_id
(!= inc_key!) and country_name
to unique fields.When i save the form, i get an Opps-overlay plus the text "true"
- so i have
1. to find out how to pass a text to the message and
2. What is the best practice for this;
just fetch or better just count rows with unique_fields = input?
Code:
public function countExistingCountriesWithIdOrName($countryId, $countryName)
{
return $this->finder('Lala:Country')
->where( ... counry_id = $countryId or country__name = $countryName
}
or anything else?