예제 #1
0
function bindTradingDayEntityArray($tradingDayEntitys)
{
    $tradingDayDtos = new TradingDayListDto();
    $tradingDayDtoArray = array();
    foreach ($tradingDayEntitys as $tradingDayEntity => $value) {
        array_push($tradingDayDtoArray, bindTradingDayEntity($value));
    }
    $tradingDayDtos->setTradingDays($tradingDayDtoArray);
    return $tradingDayDtos;
}
    $entityManager->flush();
    $tradingDayDto = bindTradingDayEntity($tradingDayEntity);
    $tradingDayDto->printData($app);
});
$app->post('/tradingdays/list', function () use($app) {
    global $entityManager;
    $tradingDayListDto = new TradingDayListDto();
    $tradingDayListDto = $tradingDayListDto->bindXml($app);
    $tradingDaysArray = array();
    foreach ($tradingDayListDto->getTradingDays() as $tradingDayDto) {
        $tradingDayEntity = bindTradingDayDto($tradingDayDto);
        $entityManager->persist($tradingDayEntity);
        $entityManager->flush();
        array_push($tradingDaysArray, bindTradingDayEntity($tradingDayEntity));
    }
    $tradingDayListDto = new TradingDayListDto();
    $tradingDayListDto->setTradingDays($tradingDaysArray);
    $tradingDayListDto->printData($app);
});
$app->put('/tradingdays/:id', function ($id) use($app) {
    global $entityManager;
    $tradingDayEntity = $entityManager->find("TradingDayEntity", $id);
    $entityManager->flush();
    $tradingDayDto = bindTradingDayEntity($tradingDayEntity);
    $tradingDayDto->printData($app);
});
$app->delete('/tradingdays/:id', function ($id) use($app) {
    global $entityManager;
    $tradingDayEntity = $entityManager->find("TradingDayEntity", $id);
    $entityManager->remove($tradingDayEntity);
    $entityManager->flush();