This forum has moved to a new location and is in read-only mode. Please visit to access the new location.


I want to request an update for RelationController.

The issue is in function makeViewWidget(), $defaultOnClick = sprintf("$.oc.relationBehavior.clickViewListRecord(:id, '%s', '%s')",$this->field,$this->relationGetSessionKey());

this variable will have an error if the Model dont have a column id, and if that column is a string. example output 1: Model with column id, and id = P20140001 $.oc.relationBehavior.clickViewListRecord(P20140001, 'categories', '74JjMD0i7f6XYBCSRKPHOoqXkRoL5to5mBupQOw7') in this case this will get an error in javascript. because P20140001 not quoted. solution: change :id to ':id'

output 2: Model without column id $.oc.relationBehavior.clickViewListRecord(:id, 'categories', '74JjMD0i7f6XYBCSRKPHOoqXkRoL5to5mBupQOw7') in this case the the :id will not be replace by any value because the model dont have any column namely id. there will be an error in javascript. solution: change $defaultOnClick = sprintf("$.oc.relationBehavior.clickViewListRecord(:id, '%s', '%s')",$this->field,$this->relationGetSessionKey()); to $defaultOnClick = sprintf("$.oc.relationBehavior.clickViewListRecord(':%s', '%s', '%s')",$this->relationObject->getModel()->getKeyName(),$this->field,$this->relationGetSessionKey()); The $this->relationObject->getModel()->getKeyName() will get the primarykey that was set in the related model.

Maybe this suggestion will be implemented to new build.

1-1 of 1

You cannot edit posts or make replies: the forum has moved to