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

Mukesh Agarwal mukesh.agarwal17 at gmail.com
Sat Nov 19 13:19:30 UTC 2011


Thanks Steven! I'm using properties for most of my data, some of these need
to be displayed and therefore I wished it were fields and I do not have to
handle the display, unfortunately I'll have to live with either writing the
display for the property or being ok with multiple tables for that field.

On Thu, Nov 17, 2011 at 10:48 PM, Steven Jones <
steven.jones at computerminds.co.uk> wrote:

> 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
> >
>



-- 
Cheers,
Mukesh Agarwal
________________________________
Innoraft Solutions <http://www.innoraft.com>  || +91 8017220799
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20111119/27ea3b7e/attachment.html 


More information about the development mailing list