Is it not possible to have fields associated to entities that do not have bundles?

Mukesh Agarwal <[email protected]>
Newsgroups gmane.comp.php.drupal.devel
Message-ID <CAE55W0u_7-Sam2XT9vCwXsoamJ6JQ9WWnUF2Xeq52WMxgHrDAQ@mail.gmail.com>
Hi Guys,

Entities seem to be the biggest problem of my life for the past few weeks
:-)

Ok, so I have an entity without any bundles. I read this in
hook_entity_info<http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_entity_info/7>that
bundles are not necessary.

This entry can be omitted if this entity type exposes a single bundle (all
> entities have the same collection of fields). The name of this single
> bundle will be the same as the entity type.


Now, I need to attach fields to my entity. I use
field_create_field<http://api.drupal.org/api/drupal/modules--field--field.crud.inc/function/field_create_field/7>for
my entity reference field which seems to work fine. When I attach this
field to my instance using
field_create_instance<http://api.drupal.org/api/drupal/modules--field--field.crud.inc/function/field_create_instance/7>,
I see an error saying:

drupal FieldException: Attempt to create an instance of field without a
> bundle


Does this mean I cannot attach fields to entities which do not have
bundles?

-- 
Cheers,
Mukesh Agarwal
________________________________
Innoraft Solutions <http://www.innoraft.com>  || +91 8017220799
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.