You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, i can create Model_User node and, for example, a few roles for user by:
public function createUser(array $userData, array $userProfileData, array $roles)
{
// ...
$this->values()->check()->save();
$this->add('roles', $roles);
// ...
}
But, how i can create the profile node? Profile is a simple model, which has user_id as primary key and other non-value data (first_name, last_name of user and etc.).
So, i tried to do this:
public function createUser(array $userData, array $userProfileData, array $roles)
{
// ...
$this->values()->check()->save();
$userId = $this->id;
$userProfileData['user_id'] = $userId;
ORM::factory('User_Profile')->values($userProfileData)->check()->save(); // this
$this->add('roles', $roles);
// ...
}
But in values() method primary_key (user_id) is unsetting! So, i need use this:
I have the next code:
So, i can create Model_User node and, for example, a few roles for user by:
But, how i can create the profile node? Profile is a simple model, which has user_id as primary key and other non-value data (first_name, last_name of user and etc.).
So, i tried to do this:
But in values() method primary_key (user_id) is unsetting! So, i need use this:
That looks strange, i think. Need to create method as 'add()' (add() for has_many relations) for has_one relation, i think.
The text was updated successfully, but these errors were encountered: