[development] Can I define fields that do not get stored in a separate table?

Steven Jones steven.jones at computerminds.co.uk
Thu Nov 17 17:18:23 UTC 2011


Hi Mukesh,

Instead of using fields you can use 'properties' of your entity, which
are stored as additional columns on your entities' base table. You are
fully responsible for providing widgets, display, loading and saving
of these properties I believe, so you lose a lot. I'm not sure there
is specific documentation about them anywhere, so I think you'll be
down to looking at other code and inferring how they work. Potentially
they are as simple as being extra columns on your base table that then
get loaded and saved by your entity controller.

I would suggest that you shouldn't really worry about the field data
being stored in different tables, so long as you go through Drupal's
APIs then you should even really need to know where your data is
stored, or how it is stored.

Hope that helps.

Regards
Steven Jones
ComputerMinds ltd - Perfect Drupal Websites

Phone : 024 7666 7277
Mobile : 07702 131 576
Twitter : darthsteven
http://www.computerminds.co.uk



On 17 November 2011 04:25, Mukesh Agarwal <mukesh.agarwal17 at gmail.com> wrote:
> I'm using hook_field_info to define my new fields. I need to use this field
> within a couple of entities and I dont need to have these fields in separate
> tables. However when I try to define the schema of a field using
> hook_field_schema I see that I need to mention the columns which means the
> table for the field will be created when I create an instance of the field
> with some entity. Is there a way out of this? Can I have my field data in
> the same table as that of my entity (which is not a node but a custom
> entity)?
>
> --
> Cheers,
> Mukesh Agarwal
> ________________________________
> Innoraft Solutions  || +91 8017220799
>


More information about the development mailing list