public function saveTimeEntry(TimeEntry $entry)
    {
        $startTime = strtotime($entry->getEntryDate());
        $endTime = $startTime + $entry->getDurationTime();
        $this->uri = 'https://www.toggl.com/api/v8/time_entries/' . $entry->getId();
        $data = [
            'time_entry' => [
                'description' => $entry->getDescription(),
                'start' => substr(strftime('%Y-%m-%dT%H:%M:%S%z', $startTime), 0, 22) . ':00',
                'stop' => substr(strftime('%Y-%m-%dT%H:%M:%S%z', $endTime), 0, 22) . ':00',
                'billable' => $entry->isBillable(),
                'wid' => $this->workspace_id,
                'duration' => $entry->getDurationTime(),
                'tags' => $entry->getTags(),
                'id' => $entry->getId(),
                'created_with' => $this->user_agent
            ]
        ];

        $this->output->debug(print_r($data, true));
        $data = json_encode($data);

        $response = $this->processRequest($data, self::PUT);
        $this->_handleError($data, $response);
        return $entry;
    }
public function saveTimeEntry(TimeEntry $entry)
    {
        $startTime = strtotime($entry->getEntryDate());
        $endTime = $startTime + $entry->getDurationTime();
        $this->uri = 'https://www.toggl.com/api/v8/time_entries/' . $entry->getId();
        $data = [
            'time_entry' => [
                'description' => $entry->getDescription(),
                'start' => substr(strftime('%Y-%m-%dT%H:%M:%S%z', $startTime), 0, 22) . ':00',
                'stop' => substr(strftime('%Y-%m-%dT%H:%M:%S%z', $endTime), 0, 22) . ':00',
                'billable' => $entry->isBillable(),
                'wid' => $this->workspace_id,
                'duration' => $entry->getDurationTime(),
                'tags' => $entry->getTags(),
                'id' => $entry->getId(),
                'created_with' => $this->user_agent
            ]
        ];

        $this->output->debug(print_r($data, true));
        $data = json_encode($data);

        $response = $this->processRequest($data, self::PUT);
        $this->_handleError($data, $response);
        return $entry;
    }
public function saveTimeEntry ( TimeEntry $ entry ) { $ startTime = strtotime ( $ entry -> getEntryDate ( ) ) ; $ endTime = $ startTime + $ entry -> getDurationTime ( ) ; $ this -> uri = 'https://www.toggl.com/api/v8/time_entries/' . $ entry -> getId ( ) ; $ data = [ 'time_entry' => [ 'description' => $ entry -> getDescription ( ) , 'start' => substr ( strftime ( '%Y-%m-%dT%H:%M:%S%z' , $ startTime ) , 0 , 22 ) . ':00' , 'stop' => substr ( strftime ( '%Y-%m-%dT%H:%M:%S%z' , $ endTime ) , 0 , 22 ) . ':00' , 'billable' => $ entry -> isBillable ( ) , 'wid' => $ this -> workspace_id , 'duration' => $ entry -> getDurationTime ( ) , 'tags' => $ entry -> getTags ( ) , 'id' => $ entry -> getId ( ) , 'created_with' => $ this -> user_agent ] ] ; $ this -> output -> debug ( print_r ( $ data , true ) ) ; $ data = json_encode ( $ data ) ; $ response = $ this -> processRequest ( $ data , self :: PUT ) ; $ this -> _handleError ( $ data , $ response ) ; return $ entry ; }
Persists a time entry to the Toggl API

@param TimeEntry $entry
@return TimeEntry
Persists a time entry to the Toggl API