[Vtigercrm-developers] Extend getInstanceById()?

Sukhdev Mohan s.mohan at myti.it
Thu Dec 10 17:01:57 GMT 2020


Ah Sorry I didn’t understood the problem at first. This is indeed an issue worth finding a clever solution.


Best Regards,
Sukhdev Mohan | Software Developer






> Il giorno 10 dic 2020, alle ore 15:39, Alan Lord <alanslists at gmail.com> ha scritto:
> 
> On 10/12/2020 14:23, Sukhdev Mohan wrote:
>> What happens if you extend the Vtiger_Record_model and then override it? 
> 
> As I said, it makes no difference because the normal way to call it is by using calling Vtiger_Record_Model::getInstanceById() first.
> 
> It is _this_ function which finds your "MyCustomModule_Record_Model" class and instantiates it. (But this is the child, not the parent).
> 
> Also in certain places in vtiger, where you might want to access an existing Record Model, say in the DetailView module, you call $this->getRecord(). This Record Model was instantiated by the Vtiger_Record_Model::getInstanceById() call so again you can't really extend the function because it has already been called. The only way is to explicitly call your own custom method in your Record Model is to use MyCustomModule_Record_Model::getInstanceById(). Which is what I am doing for now.
> 
> being able to pass a callback/method parameter to this at the vtiger level might work for most situations, but not all as described above.
> 
> Cheers
> 
> Al
> _______________________________________________
> http://www.vtiger.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20201210/059aaf7b/attachment-0001.html>


More information about the vtigercrm-developers mailing list