Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

PHP class: KenedoPropertyJoin
Recommended column type: INT UNSIGNED NULL
Object var: As property name -

With the ‘join’ type you create a reference to another model’s primary key. In the backend’s edit screen, the property will show a dropdown with the records of the referenced model.

...

Object variable names

KenedoModel::getRecord and getRecords will add these object variables (assuming property name is product_id):

  • $record->product_id - ID of the referenced record

  • $record->product_id_display_value - in the property setting ‘propNameDisplay’ you specify the name of a property. You’ll find the record value for that property in this.

Typical property settings array

In the property settings you give information about the referenced model and properties.

Code Block
languagephp
$propDefs['product_id'] = array(
	'name'=>'product_id',
	'label'=>KText::_('Product'),
	'type'=>'join',

    'modelClass'=>'ConfigboxModelAdminproducts',
	'modelMethod'=>'getRecords',
	
	'propNameKey'=>'id',
	'propNameDisplay'=>'title',
	
	'defaultlabel'=>KText::_('Select Product'),

	'positionForm'=>1000,
);

Property Settings

...

modelClass

Required: yes
Valid values: string - class name of a KenedoModel

...