summaryrefslogtreecommitdiff
path: root/app/Factory.php
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2020-07-04 11:55:43 +0100
committerGreg Roach <greg@subaqua.co.uk>2020-07-04 12:19:23 +0100
commitb4a2f8851f56e7ca6fae19d0a51ff909996d7a30 (patch)
treed7be60908d3f3953c54caa8c205e55f51c1691d4 /app/Factory.php
parentdec352c1d7404cdd35c9b1a1b5d97f29e7c4ebb5 (diff)
downloadwebtrees-b4a2f8851f56e7ca6fae19d0a51ff909996d7a30.tar.gz
webtrees-b4a2f8851f56e7ca6fae19d0a51ff909996d7a30.tar.bz2
webtrees-b4a2f8851f56e7ca6fae19d0a51ff909996d7a30.zip
Fix: #3314 - use a factory to make XREFs
Diffstat (limited to 'app/Factory.php')
-rw-r--r--app/Factory.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Factory.php b/app/Factory.php
index d6269b6ed8..f164c6287c 100644
--- a/app/Factory.php
+++ b/app/Factory.php
@@ -30,6 +30,7 @@ use Fisharebest\Webtrees\Contracts\RepositoryFactoryInterface;
use Fisharebest\Webtrees\Contracts\SourceFactoryInterface;
use Fisharebest\Webtrees\Contracts\SubmissionFactoryInterface;
use Fisharebest\Webtrees\Contracts\SubmitterFactoryInterface;
+use Fisharebest\Webtrees\Contracts\XrefFactoryInterface;
/**
* A service locator for our various factory objects.
@@ -69,6 +70,9 @@ class Factory
/** @var SubmitterFactoryInterface */
private static $submitter_factory;
+ /** @var XrefFactoryInterface */
+ private static $xref_factory;
+
/**
* Store or retrieve a factory object.
*
@@ -244,4 +248,20 @@ class Factory
return self::$submitter_factory;
}
+
+ /**
+ * Store or retrieve a factory object.
+ *
+ * @param XrefFactoryInterface|null $factory
+ *
+ * @return XrefFactoryInterface
+ */
+ public static function xref(XrefFactoryInterface $factory = null): XrefFactoryInterface
+ {
+ if ($factory instanceof XrefFactoryInterface) {
+ self::$xref_factory = $factory;
+ }
+
+ return self::$xref_factory;
+ }
}