# SWDB

# \Inventory

An inventory item.

Represents an object from the table 'inventory'.

## Summary

Methods
Properties
Constants
__construct()
get_image()
$db
$uid
$id
$name
$type
$amount
$is_monster_pices
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  application/entity/Inventory.php
Package
  Default
Class hierarchy
  \Entity
  \Inventory

## Tags

category | Entity

## Properties

### $db

    $db : resource

#### Type

resource — Database connection.

#

Inherited from
  \Entity

## Tags

None found

### $uid

    $uid : integer

#### Type

integer — Owner identifier.

#

## Tags

None found

### $id

    $id : integer|\K_Unit

#### Type

integer|\K_Unit — Item identifier. If its a monster piece, a K_Unit entity.

#

## Tags

None found

### $name

    $name : string

#### Type

string — Item name.

#

## Tags

None found

### $type

    $type : string

#### Type

string — Item type name.

#

## Tags

None found

### $amount

    $amount : integer

#### Type

integer — Item owned amount.

#

## Tags

None found

### $is_monster_pices

    $is_monster_pices : boolean

#### Type

boolean — Indicates if the item are monster pieces.

#

## Tags

None found

## Methods

### __construct()

    __construct(resource  $db, integer  $id, integer  $type = null)

Constructor.

Searches the database and retrieves the information about the building, populating it and it's items.

#### Parameters

resource | $db | Connection to the database.
integer | $id | Item identifier.
integer | $type | Item type identifier. Optional, will try to guess if null.

#

## Tags

None found

### get_image()

    get_image() : string

Gets the path to the item image. The image must be in the img/content/inventory/ directory, and its name must be the item id, padded with '0' to 9 digites, and the extension must be '.png'.

#### Returns

string —

Image URL, or a fixed unknown image.

#

## Tags

None found

### Inventory.php