Objets métiers: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 6: Line 6:




= Objets métiers =
= Business objects =
Tous les objets métiers sont définis par une classe PHP qui hérite de la classe CommonObject (définie dans le fichier commonobject.class.php).
= Objets métiers liés =
Certains objets métiers sont liés les uns aux autres. Ceci est fait dans Dolibarr via la [[Table llx_element_element]]. Mais vousn'avez pas à lire cette table pour récupérer les objets liés à un autre.
voici la portion de code qui montre comment faire cela:
<source lang="php">
// This load the array linked_object with objects that link to this one
$object->load_object_linked($object->id, $object->element);
// To load array linked_object with objects that are linked by this one
$object->load_object_linked($object->id, $object->element);
// Then choose id with objects type you need
$org_order_array = $object->linked_object["commande"];
// Now use them
$thelinkedobjectid = $org_order_array[0];
// new order instance
$thelinkedobject = new Commande($object->db);
// load the object
$thelinkedobject->fetch($thelinkedobjectid);
</source>


= Exemples =
= Exemples =

Navigation menu