public function addItem(CNabuDataObject $item)
    {
        $retval = false;

        if ($this->index_field !== false) {
            if ($item->contains($this->index_field)) {
                if (is_array($this->list)) {
                    $this->list[$item->getValue($this->index_field)] = $item;
                    $retval = $item;
                } else {
                    $this->list = array(
                        $item->getValue($this->index_field) => $item
                    );
                    $retval = $item;
                }
            }
        } else {
            if (is_array($this->list)) {
                $this->list[] = $item;
                $retval = $item;
            } else {
                $this->list = array($item);
                $retval = $item;
            }
        }

        $this->indexItem($item);

        return $retval;
    }
public function addItem(CNabuDataObject $item)
    {
        $retval = false;

        if ($this->index_field !== false) {
            if ($item->contains($this->index_field)) {
                if (is_array($this->list)) {
                    $this->list[$item->getValue($this->index_field)] = $item;
                    $retval = $item;
                } else {
                    $this->list = array(
                        $item->getValue($this->index_field) => $item
                    );
                    $retval = $item;
                }
            }
        } else {
            if (is_array($this->list)) {
                $this->list[] = $item;
                $retval = $item;
            } else {
                $this->list = array($item);
                $retval = $item;
            }
        }

        $this->indexItem($item);

        return $retval;
    }
public function addItem ( CNabuDataObject $ item ) { $ retval = false ; if ( $ this -> index_field !== false ) { if ( $ item -> contains ( $ this -> index_field ) ) { if ( is_array ( $ this -> list ) ) { $ this -> list [ $ item -> getValue ( $ this -> index_field ) ] = $ item ; $ retval = $ item ; } else { $ this -> list = array ( $ item -> getValue ( $ this -> index_field ) => $ item ) ; $ retval = $ item ; } } } else { if ( is_array ( $ this -> list ) ) { $ this -> list [ ] = $ item ; $ retval = $ item ; } else { $ this -> list = array ( $ item ) ; $ retval = $ item ; } } $ this -> indexItem ( $ item ) ; return $ retval ; }
Adds a new item to the list.
@param CNabuDataObject $item Object item to be added.
@return CNabuDataObject Returns the inserted object or false if something happens.
Adds a new item to the list .