Elgg\Database\SubtypeTable::add PHP Метод

add() публичный Метод

By default entities are loaded as one of the 4 parent objects: site, user, object, or group. If you subclass any of these you can register the classname with add_subtype() so it will be loaded as that class automatically when retrieved from the database with {@link get_entity()}.
См. также: update_subtype()
См. также: remove_subtype()
См. также: get_entity()
public add ( string $type, string $subtype, string $class = "" ) : integer
$type string The type you're subtyping (site, user, object, or group)
$subtype string The subtype
$class string Optional class name for the object
Результат integer
    public function add($type, $subtype, $class = "")
    {
        if (!$subtype) {
            return 0;
        }
        $id = $this->getId($type, $subtype);
        if (!$id) {
            $sql = "\n\t\t\t\tINSERT INTO {$this->db->prefix}entity_subtypes\n\t\t\t\t\t(type,  subtype,  class) VALUES\n\t\t\t\t\t(:type, :subtype, :class)\n\t\t\t";
            $params = [':type' => $type, ':subtype' => $subtype, ':class' => $class];
            $id = $this->db->insertData($sql, $params);
            $this->invalidateCache();
        }
        return $id;
    }