Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update symfony.com links #191

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ $post = PostFactory::new() // Create the factory for Post objects
;
```

The factories can be used inside [DoctrineFixturesBundle](https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html)
The factories can be used inside [DoctrineFixturesBundle](https://symfony.com/bundles/DoctrineFixturesBundle/current/index.html)
to load fixtures or inside your tests, [where it has even more features](#using-in-your-tests).

Want to watch a screencast 🎥 about it? Check out https://symfonycasts.com/foundry

**[Read the Documentation](https://symfony.com/bundles/foundry/current/index.html)**
**[Read the Documentation](https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html)**

## Credit

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
$ composer require zenstruck/foundry --dev

To use the ``make:*`` commands from this bundle, ensure
`Symfony MakerBundle <https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html>`_ is installed.
`Symfony MakerBundle <https://symfony.com/bundles/SymfonyMakerBundle/current/index.html>`_ is installed.

*If not using Symfony Flex, be sure to enable the bundle in your **test**/**dev** environments.*

Expand Down Expand Up @@ -913,7 +913,7 @@ Now, after creating objects using this factory, you'd have to call ``->save()``
Using with DoctrineFixturesBundle
---------------------------------

Foundry works out of the box with `DoctrineFixturesBundle <https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html>`_.
Foundry works out of the box with `DoctrineFixturesBundle <https://symfony.com/bundles/DoctrineFixturesBundle/current/index.html>`_.
You can simply use your factories and stories right within your fixture files:

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function getConfigTreeBuilder(): TreeBuilder
$treeBuilder->getRootNode()
->children()
->booleanNode('auto_refresh_proxies')
->info('Whether to auto-refresh proxies by default (https://symfony.com/bundles/foundry/current/index.html#auto-refresh)')
->info('Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)')
->defaultNull()
->end()
->arrayNode('faker')
Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/Maker/MakeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen

$io->text([
'Next: Open your new factory and set default values/states.',
'Find the documentation at https://symfony.com/bundles/foundry/current/index.html#model-factories',
'Find the documentation at https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories',
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/Maker/MakeStory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen

$io->text([
'Next: Open your story class and start customizing it.',
'Find the documentation at https://symfony.com/bundles/foundry/current/index.html#stories',
'Find the documentation at https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories',
]);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Bundle/Resources/skeleton/Factory.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public function __construct()
{
parent::__construct();

// TODO inject services if required (https://symfony.com/bundles/foundry/current/index.html#factories-as-services)
// TODO inject services if required (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services)
}

protected function getDefaults(): array
{
return [
// TODO add your default values here (https://symfony.com/bundles/foundry/current/index.html#model-factories)
// TODO add your default values here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories)
<?php
foreach ($defaultProperties as $fieldname => $type) {
echo " '".$fieldname."' => ".$type."\n";
Expand All @@ -51,7 +51,7 @@ protected function getDefaults(): array

protected function initialize(): self
{
// see https://symfony.com/bundles/foundry/current/index.html#initialization
// see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
return $this
// ->afterInstantiate(function(<?= $entity->getShortName() ?> $<?= \lcfirst($entity->getShortName()) ?>) {})
;
Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/Resources/skeleton/Story.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ final class <?= $class_name ?> extends Story
{
public function build(): void
{
// TODO build your story here (https://symfony.com/bundles/foundry/current/index.html#stories)
// TODO build your story here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories)
}
}
4 changes: 2 additions & 2 deletions src/Instantiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __invoke(array $attributes, string $class): object

foreach ($attributes as $attribute => $value) {
if (0 === \mb_strpos($attribute, 'optional:')) {
trigger_deprecation('zenstruck\foundry', '1.5.0', 'Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
trigger_deprecation('zenstruck\foundry', '1.5.0', 'Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');
continue;
}

Expand All @@ -56,7 +56,7 @@ public function __invoke(array $attributes, string $class): object
}

if (0 === \mb_strpos($attribute, 'force:')) {
trigger_deprecation('zenstruck\foundry', '1.5.0', 'Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
trigger_deprecation('zenstruck\foundry', '1.5.0', 'Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

self::forceSet($object, \mb_substr($attribute, 6), $value);

Expand Down
2 changes: 1 addition & 1 deletion src/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function object(): object
$om->getUnitOfWork()->computeChangeSet($om->getClassMetadata($this->class), $this->object);

if (!empty($om->getUnitOfWork()->getEntityChangeSet($this->object))) {
throw new \RuntimeException(\sprintf('Cannot auto refresh "%s" as there are unsaved changes. Be sure to call ->save() or disable auto refreshing (see https://symfony.com/bundles/foundry/current/index.html#auto-refresh for details).', $this->class));
throw new \RuntimeException(\sprintf('Cannot auto refresh "%s" as there are unsaved changes. Be sure to call ->save() or disable auto refreshing (see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh for details).', $this->class));
}
}

Expand Down
24 changes: 12 additions & 12 deletions tests/Functional/Bundle/Maker/MakeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ public function __construct()
{
parent::__construct();

// TODO inject services if required (https://symfony.com/bundles/foundry/current/index.html#factories-as-services)
// TODO inject services if required (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services)
}

protected function getDefaults(): array
{
return [
// TODO add your default values here (https://symfony.com/bundles/foundry/current/index.html#model-factories)
// TODO add your default values here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories)
'name' => self::faker()->text(),
];
}

protected function initialize(): self
{
// see https://symfony.com/bundles/foundry/current/index.html#initialization
// see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
return \$this
// ->afterInstantiate(function(Category \$category) {})
;
Expand Down Expand Up @@ -135,20 +135,20 @@ public function __construct()
{
parent::__construct();

// TODO inject services if required (https://symfony.com/bundles/foundry/current/index.html#factories-as-services)
// TODO inject services if required (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services)
}

protected function getDefaults(): array
{
return [
// TODO add your default values here (https://symfony.com/bundles/foundry/current/index.html#model-factories)
// TODO add your default values here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories)
'name' => self::faker()->text(),
];
}

protected function initialize(): self
{
// see https://symfony.com/bundles/foundry/current/index.html#initialization
// see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
return \$this
// ->afterInstantiate(function(Tag \$tag) {})
;
Expand Down Expand Up @@ -209,20 +209,20 @@ public function __construct()
{
parent::__construct();

// TODO inject services if required (https://symfony.com/bundles/foundry/current/index.html#factories-as-services)
// TODO inject services if required (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services)
}

protected function getDefaults(): array
{
return [
// TODO add your default values here (https://symfony.com/bundles/foundry/current/index.html#model-factories)
// TODO add your default values here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories)
'name' => self::faker()->text(),
];
}

protected function initialize(): self
{
// see https://symfony.com/bundles/foundry/current/index.html#initialization
// see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
return \$this
// ->afterInstantiate(function(Category \$category) {})
;
Expand Down Expand Up @@ -287,20 +287,20 @@ public function __construct()
{
parent::__construct();

// TODO inject services if required (https://symfony.com/bundles/foundry/current/index.html#factories-as-services)
// TODO inject services if required (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services)
}

protected function getDefaults(): array
{
return [
// TODO add your default values here (https://symfony.com/bundles/foundry/current/index.html#model-factories)
// TODO add your default values here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories)
'name' => self::faker()->text(),
];
}

protected function initialize(): self
{
// see https://symfony.com/bundles/foundry/current/index.html#initialization
// see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
return \$this
// ->afterInstantiate(function(Tag \$tag) {})
;
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/Bundle/Maker/MakeStoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class FooBarStory extends Story
{
public function build(): void
{
// TODO build your story here (https://symfony.com/bundles/foundry/current/index.html#stories)
// TODO build your story here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories)
}
}

Expand Down Expand Up @@ -70,7 +70,7 @@ final class FooBarStory extends Story
{
public function build(): void
{
// TODO build your story here (https://symfony.com/bundles/foundry/current/index.html#stories)
// TODO build your story here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories)
}
}

Expand Down Expand Up @@ -103,7 +103,7 @@ final class FooBarStory extends Story
{
public function build(): void
{
// TODO build your story here (https://symfony.com/bundles/foundry/current/index.html#stories)
// TODO build your story here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories)
}
}

Expand Down Expand Up @@ -139,7 +139,7 @@ final class FooBarStory extends Story
{
public function build(): void
{
// TODO build your story here (https://symfony.com/bundles/foundry/current/index.html#stories)
// TODO build your story here (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#stories)
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/InstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function extra_attributes_not_defined_throws_exception(): void
*/
public function can_prefix_extra_attribute_key_with_optional_to_avoid_exception(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

$object = (new Instantiator())([
'propB' => 'B',
Expand Down Expand Up @@ -229,7 +229,7 @@ public function can_set_attributes_that_should_be_force_set(): void
*/
public function prefixing_attribute_key_with_force_sets_the_property_directly(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

$object = (new Instantiator())([
'propA' => 'A',
Expand All @@ -251,7 +251,7 @@ public function prefixing_attribute_key_with_force_sets_the_property_directly():
*/
public function prefixing_snake_case_attribute_key_with_force_sets_the_property_directly(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

$object = (new Instantiator())([
'prop_a' => 'A',
Expand All @@ -273,7 +273,7 @@ public function prefixing_snake_case_attribute_key_with_force_sets_the_property_
*/
public function prefixing_kebab_case_attribute_key_with_force_sets_the_property_directly(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

$object = (new Instantiator())([
'prop-a' => 'A',
Expand All @@ -295,7 +295,7 @@ public function prefixing_kebab_case_attribute_key_with_force_sets_the_property_
*/
public function prefixing_invalid_attribute_key_with_force_throws_exception(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "force:" property prefixes is deprecated, use Instantiator::alwaysForceProperties() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Class "Zenstruck\Foundry\Tests\Unit\InstantiatorDummy" does not have property "extra".');

Expand Down Expand Up @@ -457,7 +457,7 @@ public function always_force_mode_throws_exception_for_extra_attributes(): void
*/
public function always_force_mode_allows_optional_attribute_name_prefix(): void
{
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/foundry/current/index.html#instantiation).');
$this->expectDeprecation('Since zenstruck\foundry 1.5.0: Using "optional:" attribute prefixes is deprecated, use Instantiator::allowExtraAttributes() instead (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#instantiation).');

$object = (new Instantiator())->alwaysForceProperties()([
'propB' => 'B',
Expand Down