Skip to content

Commit

Permalink
Set the att value on the model once generated.
Browse files Browse the repository at this point in the history
This allows generators of the 'Closure' type to
access attributes immediately after they are
generated via the object that is passed in as
the first paramater.
  • Loading branch information
pmccarren committed Sep 1, 2014
1 parent 0ff176c commit c6cf2fe
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,7 @@ private function make($model, array $attr, $save)
}

// Get the factory attributes for that model
$attributes = $this->attributesFor($object, $attr);

foreach ($attributes as $name => $value) {
$this->setAttribute($object, $name, $value);
}
$this->attributesFor($object, $attr);

return $object;
}
Expand Down Expand Up @@ -579,6 +575,7 @@ public function attributesFor($object, array $attr = array())
// Prepare attributes
foreach ($attributes as $key => $kind) {
$attr[$key] = $this->generateAttr($kind, $object);
$this->setAttribute($object, $key, $attr[$key]);
}

return $attr;
Expand Down

0 comments on commit c6cf2fe

Please sign in to comment.