Skip to content

Issue #44: Replace StdClass with Node. - #45

Open
jenlampton wants to merge 1 commit into
backdrop-contrib:1.x-1.xfrom
jenlampton:44-std-class
Open

Issue #44: Replace StdClass with Node.#45
jenlampton wants to merge 1 commit into
backdrop-contrib:1.x-1.xfrom
jenlampton:44-std-class

Conversation

@jenlampton

Copy link
Copy Markdown
Member

Fixes #44

Comment thread forum.module

// Merge in the "Last Post" information.
$last_post = new stdClass();
$last_post = new Node();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$last_post = new Node();
$last_post = entity_create('node', array());

I think we standardizing in core to use entity_create() instead of creating entities with new X.

Comment thread forum.module

$order = _forum_get_topic_order($sortby);
for ($i = 0; $i < count($forum_topic_list_header); $i++) {
for ($i = 1; $i < count($forum_topic_list_header); $i++) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of another PR which was merged so this no conflicts.

Comment thread forum.module
$first_new_found = FALSE;
foreach ($result as $topic) {
foreach ($result as $topic_result) {
$topic = new Node($topic_result);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$topic = new Node($topic_result);
$topic = new entity_create('node', $topic_result);

Comment thread forum.module

if ($topic->comment_count > 0) {
$last_reply = new stdClass();
$last_reply = new Node();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$last_reply = new Node();
$last_reply = new entity_create('node', array());

@herbdool

Copy link
Copy Markdown
Contributor

@jenlampton I've suggested small changes. Otherwise looks good. I've also tested it and no errors (but I wasn't able to replicate the original error either).

@richardlampitt

Copy link
Copy Markdown

Any timescale on when this PR shall be merged? I've just hit this same error on our client's site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP error comment_new_page_count(): Argument #3 ($node) must be of type Node, stdClass given

3 participants