function bindLoyaltyRewardsEntityArray($loyaltyRewardsEntitys)
{
    $loyaltyRewardsDtos = new LoyaltyRewardsListDto();
    $loyaltyRewardsDtoArray = array();
    foreach ($loyaltyRewardsEntitys as $loyaltyRewardsEntity => $value) {
        array_push($loyaltyRewardsDtoArray, bindLoyaltyRewardsEntity($value));
    }
    $loyaltyRewardsDtos->setLoyaltyRewardss($loyaltyRewardsDtoArray);
    return $loyaltyRewardsDtos;
}
    $loyaltyRewardsListDto = new LoyaltyRewardsListDto();
    $loyaltyRewardsListDto = $loyaltyRewardsListDto->bindXml($app);
    foreach ($loyaltyRewardsListDto->getLoyaltyRewardss() as $loyaltyRewardsDto) {
        $loyaltyRewardsEntity = bindLoyaltyRewardsDto($loyaltyRewardsDto);
        $entityManager->persist($loyaltyRewardsEntity);
        $entityManager->flush();
    }
});
$app->put('/loyaltyrewardss/:id', function ($id) use($app) {
    global $entityManager;
    $loyaltyRewardsEntity = $entityManager->find("LoyaltyRewardsEntity", $id);
    $entityManager->flush();
    $loyaltyRewardsDto = bindLoyaltyRewardsEntity($loyaltyRewardsEntity);
    $loyaltyRewardsDto->printData($app);
});
$app->post('/loyaltyrewardss', function () use($app) {
    global $entityManager;
    $loyaltyRewardsDto = new LoyaltyRewardsDto();
    $loyaltyRewardsDto->bindJson($app);
    $entityManager->persist($loyaltyRewardsEntity);
    $entityManager->flush();
    $loyaltyRewardsDto = bindLoyaltyRewardsEntity($loyaltyRewardsEntity);
    $loyaltyRewardsDto->printData($app);
});
$app->delete('/loyaltyrewardss/:id', function ($id) use($app) {
    global $entityManager;
    $loyaltyRewardsEntity = $entityManager->find("LoyaltyRewardsEntity", $id);
    $entityManager->remove($loyaltyRewardsEntity);
    $entityManager->flush();
});
/*Referances*/