Skip to content

Commit

Permalink
Added setting for fixture filtering by base class (default is OFF).
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Mar 22, 2018
1 parent b1ae544 commit 731f4a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Dev/FixtureBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ class FixtureBlueprint extends BaseBlueprint
*/
private static $match_on_name = 'MatchOn';

/**
* Determines whether to filter objects by the base class if no existing objects are found.
*
* @var boolean
* @config
*/
private static $filter_by_base_class = false;

/**
* The factory associated with this blueprint.
*
Expand Down Expand Up @@ -260,7 +268,7 @@ public function findObjects($identifier, $data, $filter)
{
$objects = DataList::create($this->getClass());

if (!$objects->exists()) {
if (!$objects->exists() && $this->config()->filter_by_base_class) {
$objects = DataList::create($this->getBaseClass());
}

Expand Down

0 comments on commit 731f4a2

Please sign in to comment.