Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get null value instead of empty string with Glass Mapper?

I would like to get null value instead of empty string for 'Single-Line Text' field type with Glass Mapper.

I need to recognize if any value was set or if a field was reseted to default state (and I expect there is no value - null).

Do you know if it's possible?

like image 648
Lukas Dvorak Avatar asked Nov 26 '25 08:11

Lukas Dvorak


1 Answers

You can try to write a custom Glass.Mapper data handlers.

Check this post:

Custom data handlers

like image 74
Vlad Avatar answered Dec 01 '25 19:12

Vlad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!