Closed (duplicate)
Project:
Relation
Version:
7.x-1.0-rc2
Component:
API
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
24 May 2012 at 01:31 UTC
Updated:
5 May 2013 at 06:01 UTC
I have a relation type to which I added a required date field with the default value set to 'now'. When I create a new relation entity programmatically, I want the date field to also be created and to be set with the default value.
I use the following code to create the new relation entity programmatically:
$endpoints = array(
array('entity_type' => 'user', 'entity_id' => $account->uid),
array('entity_type' => 'node', 'entity_id' => $session)
);
$relation = relation_create ('has_log_with', $endpoints);
$rid = relation_save($relation);
The code above creates the new relation entity, but it does not contain a date field set with the default value. What function(s) should I call to make this happen? Thanks!
Comments
Comment #1
chx commentedThanks for reporting this bug. I will try to figure out why this doesn't happen. It should.
Comment #2
mikran commentedSee last comment at #1345648: relation_save does not properly validate $type parameter.
Comment #3
naught101 commentedLet's just merge these - I've already started work on test for this over there anyway.