Guest User

Untitled

a guest
Oct 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) {
  2.  
  3. parent::__construct($values, $entity_type, $bundle = FALSE, $translations = array());
  4.  
  5. $values += $this->generateCharacteristics();
  6.  
  7. foreach ($values as $key => $value)
  8. {
  9.  
  10. $method = 'set'.ucfirst($key);
  11.  
  12. // For two-words attributes
  13. if( strstr($method, '_') ) {
  14. $method = explode('_', $method);
  15. $method[1] = ucfirst($method[1]);
  16. $method = implode('', $method);
  17. }
  18.  
  19. if (method_exists($this, $method))
  20. {
  21. $this->$method($value);
  22. }
  23. }
  24.  
  25.  
  26. }
Add Comment
Please, Sign In to add comment