function bindDevicesTypeEntityArray($devicesTypeEntitys)
{
    $devicesTypeDtos = new DevicesTypeListDto();
    $devicesTypeDtoArray = array();
    foreach ($devicesTypeEntitys as $devicesTypeEntity => $value) {
        array_push($devicesTypeDtoArray, bindDevicesTypeEntity($value));
    }
    $devicesTypeDtos->setDevicesTypes($devicesTypeDtoArray);
    return $devicesTypeDtos;
}
    $entityManager->flush();
    $devicesTypeDto = bindDevicesTypeEntity($devicesTypeEntity);
    $devicesTypeDto->printData($app);
});
$app->post('/devicestypes/list', function () use($app) {
    global $entityManager;
    $devicesTypeListDto = new DevicesTypeListDto();
    $devicesTypeListDto = $devicesTypeListDto->bindXml($app);
    $devicesTypesArray = array();
    foreach ($devicesTypeListDto->getDevicesTypes() as $devicesTypeDto) {
        $devicesTypeEntity = bindDevicesTypeDto($devicesTypeDto);
        $entityManager->persist($devicesTypeEntity);
        $entityManager->flush();
        array_push($devicesTypesArray, bindDevicesTypeEntity($devicesTypeEntity));
    }
    $devicesTypeListDto = new DevicesTypeListDto();
    $devicesTypeListDto->setDevicesTypes($devicesTypesArray);
    $devicesTypeListDto->printData($app);
});
$app->put('/devicestypes/:id', function ($id) use($app) {
    global $entityManager;
    $devicesTypeEntity = $entityManager->find("DevicesTypeEntity", $id);
    $entityManager->flush();
    $devicesTypeDto = bindDevicesTypeEntity($devicesTypeEntity);
    $devicesTypeDto->printData($app);
});
$app->delete('/devicestypes/:id', function ($id) use($app) {
    global $entityManager;
    $devicesTypeEntity = $entityManager->find("DevicesTypeEntity", $id);
    $entityManager->remove($devicesTypeEntity);
    $entityManager->flush();