When i go click " My Account" there is an error, it displays this:

•Notice: Undefined property: stdClass::$title i galleryformatter_field_formatter_view() (linje 186 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 194 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$title i galleryformatter_field_formatter_view() (linje 186 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 194 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$title i galleryformatter_field_formatter_view() (linje 186 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 194 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$title i galleryformatter_field_formatter_view() (linje 186 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 194 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$title i galleryformatter_field_formatter_view() (linje 186 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 194 af /home/www/xxx.xxxxxxx.xx/sites/all/modules/galleryformatter/galleryformatter.module).

And i got Entity API 7.x-1.0-beta8 + Entity tokens 7.x-1.0-beta8 enabled

How can this be fixed

Pafla

CommentFileSizeAuthor
#12 1120712-12-undefined_property.patch649 bytestwistor

Comments

manuel garcia’s picture

Can you check if this is still happening using the latest dev release for D7?

pafla’s picture

Yes, sorry i did not tell that i was using the latest d7 dev release from 29-3-2011.
and i just cheked, it is the same in firefox like ie8.

manuel garcia’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
pafla’s picture

Version: 7.x-1.x-dev » 7.x-1.0

When i was asking in chat i was been recommenden always to take those in green, but i have just tried 7.x-1.x-dev and then errors have changed i bit:
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 192 af /home/www/d7a.tipsmodforsikring.dk/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 192 af /home/www/d7a.tipsmodforsikring.dk/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 192 af /home/www/d7a.tipsmodforsikring.dk/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 192 af /home/www/d7a.tipsmodforsikring.dk/sites/all/modules/galleryformatter/galleryformatter.module).
•Notice: Undefined property: stdClass::$nid i galleryformatter_field_formatter_view() (linje 192 af /home/www/d7a.tipsmodforsikring.dk/sites/all/modules/galleryformatter/galleryformatter.module).

manuel garcia’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Assigned: pafla » Unassigned
Status: Active » Postponed (maintainer needs more info)

Well, I'm sorry but I cannot reproduce this problem on the latest 7.x dev (2011-Mar-26).

The line numbers in those errors don't correspond to any calls to an object. Even more, line 194 of galleryformatter.module is a blank line...

pafla’s picture

I think it is a mistake line 186+194 is in 7.x-1.0 - line 192 is in 7.x-1.x-dev

Line 192 is $slideset_id = $field['field_name'] . '-' . $entity->nid;

manuel garcia’s picture

Oops, we cross-posted there.

Yes, usually you use the ones in green for production, but if you find a bug, it's normal to test the latest development version and see if it has been fixed there already (the dev version will become the next stable version normally).

I do see $entity->nid in line 192, but this has the NID in my install... something weird is going on in your installation. I have installed entity api and entity token but that doesnt seem to have any effect.

pafla’s picture

I don´t know what this mean, but when i change line 192 in 7.x dev (2011-Mar-26).
What does . '-' . $entity->nid; mean

Change from
$slideset_id = $field['field_name'] . '-' . $entity->nid;
-to-
$slideset_id = $field['field_name']; // . '-' . $entity->nid;

Then the error disappear

manuel garcia’s picture

Pafla what entity is your image field being attached to? The user? A content type?

Can you provide more information, configuration, screenshot etc about how the field is setup please? It's so that I can try reproducing it on my side to troubleshoot =)

pafla’s picture

i made a image field in user account

What does this in thread #8 mean

manuel garcia’s picture

Title: Notice: Undefined property » Notice: Undefined property $entity->nid if field is attached something other than a node
Status: Postponed (maintainer needs more info) » Active

$slideset_id = $field['field_name'] . '-' . $entity->nid; is used for setting the unique slideset id... the $entity->nid is normally the node id, but its giving out that notice because in your case, there is no node, but a user id.

Since this module in d6 was only used on nodes, I did not think of d7 fields, which are able to attach themselves to any entity, be it a node, a user, a taxonomy, or whatever.

Many thanks for reporting, and taking the time to follow up on the report Pafla, I'll see what I can do as soon as I get some quiet time to study this, and try to generalize the module for any type of entity.

twistor’s picture

StatusFileSize
new649 bytes

This patch gets rid of the stated problem. The only other thing I see is using $entity->title.

twistor’s picture

Status: Active » Needs review
manuel garcia’s picture

Status: Needs review » Fixed

I've given some this thought, and was reluctant to use entity_extract_ids, since this is called once per image in your patch:

At first I committed common use-cases for node, user and taxonomy entities, in order to avoid calling that function so many times. But then I realized we could just take that out of the foreach loop, have it call only once per gallery, and have a single line for all entity types. Relying on that api call also makes the code more sustainable.

In any case, this is now fixed, and will be available in the next stable release (or in dev if you cant wait). Thanks twistor!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jjcarrion’s picture

I used the patch in my project and the error disappeared, but also the images disappeared.

At last, I have installed the development version and it has worked everything correctly.

manuel garcia’s picture

@jjcarrion Thank you for reporting, I think I'll make another stable release of 7.x soon.

pafla’s picture

Issue summary: View changes