CoreBOSBB
Where does the function 'getSalesEntityType' come from? - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: Where does the function 'getSalesEntityType' come from? (/showthread.php?tid=207)



Where does the function 'getSalesEntityType' come from? - Guido1982 - 11-24-2015

I was studying this example from the documentation, and noticed this function called 'getSalesEntityType' that checks the entitytype on the id pulled in from the 'data' object. Since no files were included in this function file, I can't see how where this function comes from, although I can understand what it does from the name, I'd rather have a better understanding so I know what I'm doing when writing my own workflow methods. Can anyone explain?


RE: Where does the function 'getSalesEntityType' come from? - joebordes - 11-24-2015

include/utils/CommonUtils.php
https://github.com/tsolucio/corebos/blob/master/include/utils/CommonUtils.php#L470


the corebos updater class is executed inside a controlled environment where all the possibly required functionality is already loaded for you. That way you can concentrate on doing the change.


RE: Where does the function 'getSalesEntityType' come from? - Guido1982 - 11-24-2015

Hey Joe,

Thanks. I don't understand the second part quite yet. I understand the initial setup and adding of the task to the system is done inside the
Code:
build/changeSets/workflow_contactassignedto.php
file, that creates a Class that extends 'cbupdaterWorker'. That file basically registers
Code:
include/wfMethods/updateContactAssignedTo.php
into the database, but this file doesn't define or extend a class, so how can it work inside of a corebos updater class? Or can any function, even though in a separate file be considered an extention of the corebos updater class when it was added via the corebos updater class?


RE: Where does the function 'getSalesEntityType' come from? - joebordes - 11-24-2015

Sorry: the changeset works inside coreBOS updater. The updateContactAssignedTo.php is executed by the workflow system which loads all the necessary stuff itself.

In general you can count on having all these functions. If you load vtlib/Module.php it will load (almost) everything you need.


RE: Where does the function 'getSalesEntityType' come from? - Guido1982 - 11-24-2015

Ah that was my understanding, yes. It's just that I didn't see any includes in the file. But I can assume that when inside workflow tasks, the workflow system has already included many functions. Come to think of it, I was looking at this as if the function were the starting point. I should look at it more as if the function file is the inclusion (before which many other inclusions may have been made).


RE: Where does the function 'getSalesEntityType' come from? - joebordes - 11-24-2015

yes, that is more or less the things: both corebos updater and workflow try to make it as easy as possible for you to just do what you need to do and count on having the basics in place