79702664

Date: 2025-07-15 21:08:02
Score: 1.5
Natty:
Report link

Found my gremlin.

I had three hasOne associations that when I appended the “_key” in the table column, table and the form, all started working.
Example: Changed “tax_cod” to “tax_cod_key”

No idea why this logic worked in v4.5.8 and not in v5.2.5. Naming conventions???

      $this->hasOne('TaxCod', [
            'className' => 'DataGroupDetails'
         ])
         ->setForeignKey('secondary_key')
         ->setBindingKey('tax_cod')
         ->setProperty('tax_cod')
         ->setConditions(['TaxCod.data_group_id' => 7])
         ->setDependent(false);

To

      $this->hasOne('TaxCod', [
            'className' => 'DataGroupDetails'
         ])
         ->setForeignKey('secondary_key')
         ->setBindingKey('tax_cod_key')
         ->setProperty('tax_cod')
         ->setConditions(['TaxCod.data_group_id' => 7])
         ->setDependent(false);

Different association that worked from the start

      $this->hasOne('CompanyType', [
            'className' => 'DataGroupDetails'
         ])
         ->setForeignKey('secondary_id')
         ->setBindingKey('company_type_id')
         ->setProperty('company_type')
         ->setConditions(['CompanyType.data_group_id' => 1])
         ->setDependent(false);
Reasons:
  • Blacklisted phrase (1): ???
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: smoeckel