I am experiencing a strange behavior on v 1.3.4 :
class UserProfile
{
// .... code
public function initialize()
{
$this->hasOne('user_profile_user_id', 'App\Core\Models\User', 'id', array(
'alias' => 'user',
'reusable' => true
));
}
// ... code
}
class User
{
// .... code
public function initialize()
{
$this->hasOne('user_profile_id', 'App\Core\Models\UserProfile', 'id', array(
'alias' => 'profile',
'reusable' => true
));
}
// ... code
}
Creating a record :
$security = $this->getDI()->get('security');
$user = new User();
$user->setUserFirstName($data['user_first_name']);
$user->setUserLastName($data['user_last_name']);
$user->setUserEmail($data['user_email']);
$user->setUserPassword($security->hash($data['user_password']));
$user->setUserIsActive($data['user_is_active']);
$user_group_id = $this->findFirstGroupByName($user_group_name)->getId();
$user->setUserGroupId($user_group_id);
$profile = new UserProfile();
$profile->setUserProfileLocation($data['user_profile_location']);
$profile->setUserProfileBirthday($data['user_profile_birthday']);
$user->profile = $profile;
$user->create();
Will return me: user_profile_user_id is required
Anyone had similar problems ?