コード例 #1
0
function bindUserCarEntityArray($userCarEntitys)
{
    $userCarDtos = new UserCarListDto();
    $userCarDtoArray = array();
    foreach ($userCarEntitys as $userCarEntity => $value) {
        array_push($userCarDtoArray, bindUserCarEntity($value));
    }
    $userCarDtos->setUserCars($userCarDtoArray);
    return $userCarDtos;
}
コード例 #2
0
    $userCarListDto = new UserCarListDto();
    $userCarListDto = $userCarListDto->bindXml($app);
    foreach ($userCarListDto->getUserCars() as $userCarDto) {
        $userCarEntity = bindUserCarDto($userCarDto);
        $entityManager->persist($userCarEntity);
        $entityManager->flush();
    }
});
$app->put('/usercars/:id', function ($id) use($app) {
    global $entityManager;
    $userCarEntity = $entityManager->find("UserCarEntity", $id);
    $entityManager->flush();
    $userCarDto = bindUserCarEntity($userCarEntity);
    $userCarDto->printData($app);
});
$app->post('/usercars', function () use($app) {
    global $entityManager;
    $userCarDto = new UserCarDto();
    $userCarDto->bindJson($app);
    $entityManager->persist($userCarEntity);
    $entityManager->flush();
    $userCarDto = bindUserCarEntity($userCarEntity);
    $userCarDto->printData($app);
});
$app->delete('/usercars/:id', function ($id) use($app) {
    global $entityManager;
    $userCarEntity = $entityManager->find("UserCarEntity", $id);
    $entityManager->remove($userCarEntity);
    $entityManager->flush();
});
/*Referances*/