ORM::id PHP Method

id() public method

Get the primary key ID of this object.
public id ( $disallow_null = false )
    public function id($disallow_null = false)
    {
        $id = $this->get($this->_get_id_column_name());
        if ($disallow_null) {
            if (is_array($id)) {
                foreach ($id as $id_part) {
                    if ($id_part === null) {
                        throw new Exception('Primary key ID contains null value(s)');
                    }
                }
            } else {
                if ($id === null) {
                    throw new Exception('Primary key ID missing from row or is null');
                }
            }
        }
        return $id;
    }

Usage Example

Esempio n. 1
0
 /**
  * Get the database ID of this model instance.
  *
  * @return integer
  */
 public function id()
 {
     return $this->orm->id();
 }
All Usage Examples Of ORM::id
ORM