Newscoop\Entity\User::getAttribute PHP Method

getAttribute() public method

Get attribute
public getAttribute ( string $name ) : mixed
$name string
return mixed
    public function getAttribute($name)
    {
        if (isset($this->attributes[$name])) {
            return $this->attributes[$name]->getValue();
        }
        return;
    }

Usage Example

Beispiel #1
0
 public function setDefaultsFromEntity(User $user)
 {
     $defaults = array('first_name' => $user->getFirstName(), 'last_name' => $user->getLastName(), 'username' => $user->getUsername(), 'attributes' => array());
     $profile = $this->getSubForm('attributes');
     foreach ($profile as $field) {
         $defaults['attributes'][$field->getName()] = (string) $user->getAttribute($field->getName());
     }
     $this->setDefaults($defaults);
 }
All Usage Examples Of Newscoop\Entity\User::getAttribute