Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SigalZ's avatar

enum or accessor

Hello,

I am a bit confused and would like some help deciding what to use.

I have a table called products that has 2 fields: publish and in_stock

Both fields are either true or false.

When displaying the fields to the user I would like to display: Published or Not published for the publish field

In Stock or Out of Stock for the in_stock field

When coding I would like to check if the product is published or not, if it's in stock or not e.g.:

if($product->publish) {
do something
} else {
do something else
}

What should I use here? enum? accessor?

What should be the field type? enum? varchar? boolean? tinyint?

I can't decide what to use.

Thank you

0 likes
0 replies

Please or to participate in this conversation.