Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thephpleague/factory-muffin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1
Choose a base ref
...
head repository: pmccarren/factory-muffin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.1
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Sep 1, 2014

  1. Copy the full SHA
    0ff176c View commit details
  2. Set the att value on the model once generated.

    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.
    pmccarren committed Sep 1, 2014
    Copy the full SHA
    c6cf2fe View commit details
Showing with 3 additions and 6 deletions.
  1. +3 −6 src/Factory.php
9 changes: 3 additions & 6 deletions src/Factory.php
Original file line number Diff line number Diff line change
@@ -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;
}
@@ -502,7 +498,7 @@ public function isPendingOrSaved($object)
public function deleteSaved()
{
$exceptions = array();
foreach ($this->saved as $object) {
foreach (array_reverse($this->saved) as $object) {
try {
if (!$this->delete($object)) {
throw new DeleteFailedException(get_class($object));
@@ -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;