コード例 #1
0
 public function testDelete()
 {
     $incomingMapper = new IncomingMapper();
     $incomingMapper->setId(1);
     $incomingMapper->deleteIncoming();
     $this->assertEquals(new Incoming(), $incomingMapper->selectIncoming());
 }
コード例 #2
0
                    $options = array('indent' => '     ', 'addDecl' => false, XML_SERIALIZER_OPTION_RETURN_RESULT => true, "defaultTagName" => "incoming");
                    $serializer = new XML_Serializer($options);
                    Rest::sendResponse(200, $serializer->serialize($incomingsArray), 'application/xml');
                }
            }
        } else {
            Rest::sendResponse(204);
        }
        break;
    case 'post':
        try {
            $incoming = new Incoming();
            $data_incoming = $http->getRequestVars();
            $incoming = initObject($data_incoming, $incoming, true);
            if (!emptyObject($incoming)) {
                $incomingMapper = new IncomingMapper();
                if ($incomingMapper->insertIncoming($incoming)) {
                    Rest::sendResponse(200);
                }
            } else {
                throw new InvalidArgumentException('Need arguments to POST data !');
            }
        } catch (InvalidArgumentException $e) {
            print $e->getMessage();
            exit;
        }
        break;
    default:
        Rest::sendResponse(501);
        break;
}
コード例 #3
0
                if ($http->getHttpAccept() == 'xml') {
                    $options = array('indent' => '     ', 'addDecl' => false, "defaultTagName" => "incoming", XML_SERIALIZER_OPTION_RETURN_RESULT => true);
                    $serializer = new XML_Serializer($options);
                    Rest::sendResponse(200, $serializer->serialize($incomingArray), 'application/xml');
                }
            }
        } else {
            Rest::sendResponse(204);
        }
        break;
    case 'delete':
        $incoming_ = new Incoming();
        $incomingMapper = new \IncomingMapper();
        if ($incomingMapper->deleteIncoming()) {
            Rest::sendResponse(200);
        } else {
            Rest::sendResponse(500);
        }
        break;
    case 'put':
        $incoming_ = new Incoming();
        $data_incoming_ = $http->getRequestVars();
        $incoming_ = initObject($data_incoming_, $incoming_, true);
        $incomingMapper = new \IncomingMapper();
        $incomingMapper->updateIncoming($incoming_);
        Rest::sendResponse(200);
        break;
    default:
        Rest::sendResponse(501);
        break;
}