Hi,

When dealing with a large number of information, it seems useful to save all information in the same table with the entity rather then having the entity fieldable. In other words I would prefer to add entity properties rather then adding them as fields, trying to avoid unnecessary joins.

Having this said, while playing with this module I tried to add a Decimal property to my test entity for storing thinks like quantity and price. But it looks like the Decimal property is actually creating a float field in the table, not a decimal.

I would like to have the ability to implement an actual decimal property with a properly configured behavior. Can someone help with some examples?

Any help is appreciated.

Thanks!

Comments

mihai_brb’s picture

Status: Active » Closed (fixed)

I figured it out by following some example code available in some issues, mainly http://drupal.org/node/1650990

bojanz’s picture

If you are not using bcmath to do the value manipulations, then your decimal field will still be treated as a float in PHP (since PHP has no decimal data type)
Keep that in mind.

mihai_brb’s picture

Thanks,
The problem is the mysql handling for float. Saving for example product price as a float is a really bad idea.

Mihai