Skip to content

Commit

Permalink
Fixed bug with SiteTree refering to unpublished objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Mar 14, 2018
1 parent 13f734f commit 0b74980
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Dev/FixtureBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public function findOrMakeObject($identifier, $data = null, $fixtures = null, $f

$object->write();

// Handle Versioning:

$this->publishObject($object);

// Record Object in Fixtures:

$this->addFixture($object, $identifier);
Expand Down Expand Up @@ -362,6 +366,24 @@ public function writeObject(DataObject $object)

// Handle Versioning:

$this->publishObject($object);

// Answer Object:

return $object;
}

/**
* Publishes the given object (if the object is versioned).
*
* @param DataObject $object
*
* @return DataObject
*/
public function publishObject(DataObject $object)
{
// Detect Versioned Extension:

if ($object->hasExtension(Versioned::class)) {

// Copy Draft to Live:
Expand Down

0 comments on commit 0b74980

Please sign in to comment.