Nothing in the labor code nor decided cases by the Supreme Court says that such a requirement by your employer is patently illegal.
As Council has aptly stated, it is an unusual requirement, but it is quite understandable from the employer's perspective since there are indeed potential employees who regularly go AWOL without even finishing the training period. It is a way of securing that they can get cashiers to work for them without resorting to AWOL kaagad kapag nahirapan na. Sayang din naman kasi yung oras na ginugol nung employer to train employees, tapos aalis lang agad.
To protect your diploma, make sure to claim it back again after finishing all the requirements needed by your employer, whether it be a stipulated period na kelangan matapos or any other stipulation. Important na naiintindihan mo lahat ng pinipirmahan mong employment contract terms para apprised ka sa mga pwedeng mangyari. Have the HR explain any terms na di mo naiintindihan.
Alternatively, you can present a photocopied diploma na may stamp na certified original from your school in case you have one. That's almost as good as any diploma, and explain it to your employer that it is usually expensive to have another diploma made from your school and that you want to safekeep such an important document. Siguro they'll make you sign some other form of collateral or security, like a training bond of sorts.
Good luck in your situation.