Gizra / message

https://www.drupal.org/project/message
22 stars 50 forks source link

Some base methods not working: setOwnerId, setCreatedTime #108

Closed mccrodp closed 8 years ago

mccrodp commented 8 years ago

I am pretty sure that the above methods are not working and while perhaps related, I believe getOwnerId() is not working either.

I noticed this as after calling these methods in submitForm() in Message UI the entity object does not reflect the new values, either on a new or existing message entity. See usage in: https://github.com/mccrodp/message_ui/blob/8.x-1.x/src/Form/MessageForm.php#L178

When stepping through this it seems to behave differently than the node entity when it calls it's setOwnerId() for instance.

mccrodp commented 8 years ago

When we looked at this earlier, it seemed to be setting the 'uid' value in the nested array in 'values' on the Message entity. It did not set the value directly on the Message. i.e. - $message->uid not set, shouldn't it set both?

mccrodp commented 8 years ago

This is now evident in the PR: https://github.com/Gizra/message/pull/107 where we have a new MessageCreateTest which tests $this->assertEqual($this->user->id(), $message->getOwnerId(), 'The default value for uid was set correctly.'); after calling $message->save().

After calling save on a message we can see the output attached. The mid, uid, etc. are not set, but the uid we can see set in the values array. Is there something that returns the mid and other values later in the process? I'm unsure of this, but as originally stated, this is not the same as happens when checking node object after $node->save().

message-object-post-save
jhedstrom commented 8 years ago

The setOwnerId() issue should be resolved by #130.

jhedstrom commented 8 years ago

In manual testing via drush php, the setCreatedTime() method appears to be working:

screen shot 2016-10-14 at 9 54 07 am
amitaibu commented 8 years ago

wow, what's that REPL?

jhedstrom commented 8 years ago

Psy shell...part of the latest Drush, via drush php =)