Last active
January 25, 2017 09:47
-
-
Save martsie/fd5f4e6e52d451c39b5c5d4b35a4da8e to your computer and use it in GitHub Desktop.
Nicer OOP implementation of storing and accessing structured data in Drupal 7 user object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the employee salary of a user. | |
$account = user_load(1); | |
$employee_details = new EmployeeDetails($account); | |
$employee_details->setEmployeeSalary(65000); | |
user_save($account); | |
// Retrieve the employee salary for a given user. | |
$account = user_load(1); | |
$employee_details = new EmployeeDetails($account); | |
$salary = $employee->getEmployeeSalary(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment