<div dir="ltr">Hi Alan,<div><br></div><div>So to make use of my extended method, I have to use<br>"MyCustom_Record_Model::getInstanceById(...)" explicitly to achieve the<br>required result.<br><br>Is this design choice deliberate? Is there another way?<br></div><div><br></div><div>Yes! The design choice is deliberate, Core record api getInstanceById() should generate the requested module object and instantiate to current record.</div><div><br></div><div>In the current approach, the only way to invoke the custom defined getInstanceById() is as you specified above.</div><div><br></div><div>But i do agree with your thought for callback in this case, where the constructor trigger is not of much use. </div><div><br></div><div>Please do file an issue on <a href="http://code.vtiger.com">code.vtiger.com</a>. So that we can review to take it forward.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 10, 2020 at 10:36 PM Sukhdev Mohan <<a href="mailto:s.mohan@myti.it">s.mohan@myti.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Ah Sorry I didn’t understood the problem at first. This is indeed an issue worth finding a clever solution.<div><br></div><div><br><div>
<div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div>Best Regards,<br><b>Sukhdev Mohan</b> | <b>Software Developer</b></div></div></div><br></div><br></div><br></div><br><br>
</div>
<div><br><blockquote type="cite"><div>Il giorno 10 dic 2020, alle ore 15:39, Alan Lord <<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>> ha scritto:</div><br><div><div>On 10/12/2020 14:23, Sukhdev Mohan wrote:<br><blockquote type="cite">What happens if you extend the Vtiger_Record_model and then override it? <br></blockquote><br>As I said, it makes no difference because the normal way to call it is by using calling Vtiger_Record_Model::getInstanceById() first.<br><br>It is _this_ function which finds your "MyCustomModule_Record_Model" class and instantiates it. (But this is the child, not the parent).<br><br>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.<br><br>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.<br><br>Cheers<br><br>Al<br>_______________________________________________<br><a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></div></div></blockquote></div><br></div></div>_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">With<br>Best Regards<br>Uma.S<br><div>Vtiger Team</div></div></div>