public function fromArray(array $input) {
        $fillable = $this->getFillableFields();

        foreach($input as $key => $value) {
            if(in_array($key, $fillable)) {
                $this->{'set' . ucfirst($key)}($value);
            } else {
                throw new MassAssignmentException($key);
            }
        }
    }
public function fromArray(array $input) {
        $fillable = $this->getFillableFields();

        foreach($input as $key => $value) {
            if(in_array($key, $fillable)) {
                $this->{'set' . ucfirst($key)}($value);
            } else {
                throw new MassAssignmentException($key);
            }
        }
    }
public function fromArray ( array $ input ) { $ fillable = $ this -> getFillableFields ( ) ; foreach ( $ input as $ key => $ value ) { if ( in_array ( $ key , $ fillable ) ) { $ this -> { 'set' . ucfirst ( $ key ) } ( $ value ) ; } else { throw new MassAssignmentException ( $ key ) ; } } }
Fills the entity from and array.

@param array $input
@return void
@throws MassAssignmentException if the input tries to assign an not-fillable field.
Fills the entity from and array .