CommonDBTM::getEntityID PHP Method

getEntityID() public method

Can be overloaded (ex : infocom)
public getEntityID ( ) : ID
return ID of the entity
    function getEntityID()
    {
        if ($this->isEntityAssign()) {
            return $this->fields["entities_id"];
        }
        return -1;
    }

Usage Example

 /**
  * Get the ID of entity assigned to the object
  *
  * @return ID of the entity
  **/
 function getEntityID()
 {
     // Case of Duplicate Entity info to child
     if (parent::isEntityAssign()) {
         return parent::getEntityID();
     }
     if (preg_match('/^itemtype/', $this->itemtype)) {
         $type = $this->fields[$this->itemtype];
     } else {
         $type = $this->itemtype;
     }
     if (class_exists($type)) {
         $item = new $type();
         if ($item->getFromDB($this->fields[$this->items_id]) && $item->isEntityAssign()) {
             return $item->getEntityID();
         }
     }
     return -1;
 }
All Usage Examples Of CommonDBTM::getEntityID
CommonDBTM