Found that there're 'node id, node type, node status' hardcoded in many places in heartbeat, it's not good when other entities want to log their activity.

Comments

Stalski’s picture

Status: Active » Closed (fixed)

Issue started in #1189948: Notice: Trying to get property of non-object in HeartbeatActivity

For the issue itself, this should never happen. If heartbeat has a reference to a node ID, that's because it should be like that.
If a node is deleted, heartbeat will remove the entries that rely on this node. This results in the fact that what you're experiencing, should never happen.

I never had that before so I am setting this to "can't reproduce". The only hint I can give you is to remove nodes the normal way AND populate the nid and nid_target in heartbeat messages only with nodes that exist. With the last remark I mean that if you assign the nid to a term for instance, this will also happen.

You will see the status is closed (fixed) and that is because I also added a solution for such behavior. But keep in mind what I said, there IS something broken and maybe you should run some query that deletes heartbeat activity messages that reference to a non-existing node.

rogical’s picture

Status: Closed (fixed) » Active

Actually, I'm using my own entity with heartbeat, I don't know if you have tried using Heartbeat on other entities.

As there're more and more entities than node in the drupal world, I think it's good to remove node dependency on heartbeat, as it really can record any entities' CRUD activity, also custom activities.

So far, heartbeat + rules works fine with my custom entity, except some warnings, then when I look into the code, found it's a lot node dependent.

I think other people would also note this sooner or later, as you can find there're too many custom entities in the module list now. I mean use entity_id, entity_type in the code, and consider more about other entities, maybe also integrate with module Entity API.

I set this to active, you may closed it if it can't be. Thanks!

Stalski’s picture

Status: Active » Postponed

I know what you mean, but in the drupal world , D7 that is, there is still too much on nodes and comments.
Besides nodes are for content that need an url, publication status, author, etc ... so nodes are the most logical data type to use, beside others.

I will try and rewrite heartbeat api so it takes entity_type, entity_id, and so on... but I guess that will be another branch since the change is too big. Postponed for now

rogical’s picture

Yes, at first I want to try to do this work, but found it has many rewrite.

I suggest you can open a branch, for entity rewrite. I may help if possible.

Stalski’s picture

Surely you can help and I would be very greatfull. I am even looking for comaintainer(s), especially for drupal6, which is not very rewarding I guess.

rogical’s picture

I'm not using D6, when you open a 7.x.2.x branch, I will try to upload patches here. thanks.