forked from zenstruck/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow to use Factory::create() in data provider
- Loading branch information
Showing
33 changed files
with
889 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ DATABASE_URL="mysql://root:[email protected]:3307/foundry_test?serverVersion=5.7.42 | |
MONGO_URL="mongodb://127.0.0.1:27018/dbName?compressors=disabled&gssapiServiceName=mongodb" | ||
DATABASE_RESET_MODE="schema" | ||
USE_DAMA_DOCTRINE_TEST_BUNDLE="0" | ||
USE_FOUNDRY_PHPUNIT_EXTENSION="0" | ||
PHPUNIT_VERSION="9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
use Doctrine\Persistence\ObjectRepository; | ||
use Zenstruck\Foundry\Configuration; | ||
use Zenstruck\Foundry\Factory; | ||
use Zenstruck\Foundry\Object\Instantiator; | ||
use Zenstruck\Foundry\FactoryCollection; // keep me! | ||
use Zenstruck\Foundry\Object\Instantiator; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
|
@@ -43,6 +43,19 @@ | |
*/ | ||
abstract class PersistentProxyObjectFactory extends PersistentObjectFactory | ||
{ | ||
/** | ||
* @return T&Proxy<T> | ||
*/ | ||
final public function create(callable|array $attributes = []): object | ||
{ | ||
$configuration = Configuration::instance(); | ||
if ($configuration->inADataProvider()) { | ||
return ProxyGenerator::wrapFactory($this, $attributes); | ||
} | ||
|
||
return parent::create($attributes); | ||
} | ||
|
||
/** | ||
* @return class-string<T> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.