WIP: Symfony 6 project remake #2

Draft
skobkin wants to merge 103 commits from symfony6_remake into master
8 changed files with 216 additions and 36 deletions
Showing only changes of commit dc683362d7 - Show all commits

View file

@ -9,6 +9,7 @@
"ext-iconv": "*", "ext-iconv": "*",
"doctrine/annotations": "^2.0", "doctrine/annotations": "^2.0",
"doctrine/doctrine-bundle": "^2.8", "doctrine/doctrine-bundle": "^2.8",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.14", "doctrine/orm": "^2.14",
"jms/serializer-bundle": "^5.2", "jms/serializer-bundle": "^5.2",

167
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "adf20c9a601a7f685ece9da4a4ac9e47", "content-hash": "93a3119667f6f43c8cf9d580299de8c8",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -352,6 +352,88 @@
], ],
"time": "2022-10-09T11:47:59+00:00" "time": "2022-10-09T11:47:59+00:00"
}, },
{
"name": "doctrine/data-fixtures",
"version": "1.6.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/data-fixtures.git",
"reference": "c27821d038e64f1bfc852a94064d65d2a75ad01f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/c27821d038e64f1bfc852a94064d65d2a75ad01f",
"reference": "c27821d038e64f1bfc852a94064d65d2a75ad01f",
"shasum": ""
},
"require": {
"doctrine/persistence": "^1.3.3|^2.0|^3.0",
"php": "^7.2 || ^8.0"
},
"conflict": {
"doctrine/dbal": "<2.13",
"doctrine/orm": "<2.12",
"doctrine/phpcr-odm": "<1.3.0"
},
"require-dev": {
"doctrine/coding-standard": "^10.0",
"doctrine/dbal": "^2.13 || ^3.0",
"doctrine/deprecations": "^1.0",
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
"doctrine/orm": "^2.12",
"ext-sqlite3": "*",
"phpstan/phpstan": "^1.5",
"phpunit/phpunit": "^8.5 || ^9.5",
"symfony/cache": "^5.0 || ^6.0",
"vimeo/psalm": "^4.10"
},
"suggest": {
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
"doctrine/orm": "For loading ORM fixtures",
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Data Fixtures for all Doctrine Object Managers",
"homepage": "https://www.doctrine-project.org",
"keywords": [
"database"
],
"support": {
"issues": "https://github.com/doctrine/data-fixtures/issues",
"source": "https://github.com/doctrine/data-fixtures/tree/1.6.3"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures",
"type": "tidelift"
}
],
"time": "2023-01-07T15:10:22+00:00"
},
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",
"version": "3.6.1", "version": "3.6.1",
@ -622,6 +704,89 @@
], ],
"time": "2023-02-03T09:32:42+00:00" "time": "2023-02-03T09:32:42+00:00"
}, },
{
"name": "doctrine/doctrine-fixtures-bundle",
"version": "3.4.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
"reference": "601988c5b46dbd20a0f886f967210aba378a6fd5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/601988c5b46dbd20a0f886f967210aba378a6fd5",
"reference": "601988c5b46dbd20a0f886f967210aba378a6fd5",
"shasum": ""
},
"require": {
"doctrine/data-fixtures": "^1.3",
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.6.0",
"doctrine/persistence": "^1.3.7|^2.0|^3.0",
"php": "^7.1 || ^8.0",
"symfony/config": "^3.4|^4.3|^5.0|^6.0",
"symfony/console": "^3.4|^4.3|^5.0|^6.0",
"symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0",
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0",
"symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpstan/phpstan": "^1.4.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20",
"symfony/phpunit-bridge": "^6.0.8",
"vimeo/psalm": "^4.22"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Doctrine\\Bundle\\FixturesBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Doctrine Project",
"homepage": "https://www.doctrine-project.org"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony DoctrineFixturesBundle",
"homepage": "https://www.doctrine-project.org",
"keywords": [
"Fixture",
"persistence"
],
"support": {
"issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues",
"source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.4.2"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle",
"type": "tidelift"
}
],
"time": "2022-04-28T17:58:29+00:00"
},
{ {
"name": "doctrine/doctrine-migrations-bundle", "name": "doctrine/doctrine-migrations-bundle",
"version": "3.2.2", "version": "3.2.2",

View file

@ -15,4 +15,5 @@ return [
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true], Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
]; ];

View file

@ -1,17 +1,17 @@
<?php <?php
declare(strict_types=1);
namespace src\PointToolsBundle\DataFixtures\ORM; namespace App\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
use src\PointToolsBundle\Entity\Blogs\Comment; use App\Entity\Blog\{Comment, Post};
use src\PointToolsBundle\Entity\Blogs\Post; use App\Entity\User;
use src\PointToolsBundle\Entity\User;
class LoadCommentsData extends AbstractFixture implements OrderedFixtureInterface class LoadCommentsData extends Fixture implements OrderedFixtureInterface
{ {
public function load(ObjectManager $om) public function load(ObjectManager $om): void
{ {
/** @var Post $post */ /** @var Post $post */
$post = $this->getReference('test_post_longpost'); $post = $this->getReference('test_post_longpost');
@ -30,7 +30,7 @@ class LoadCommentsData extends AbstractFixture implements OrderedFixtureInterfac
foreach (range(1, 10000) as $num) { foreach (range(1, 10000) as $num) {
$comment = (new Comment()) $comment = (new Comment())
->setNumber($num) ->setNumber($num)
->setDeleted(mt_rand(0, 15) ? false : true) ->setDeleted(\random_int(0, 15) ? false : true)
->setCreatedAt(new \DateTime()) ->setCreatedAt(new \DateTime())
->setAuthor($users[array_rand($users)]) ->setAuthor($users[array_rand($users)])
->setRec(false) ->setRec(false)
@ -42,8 +42,8 @@ class LoadCommentsData extends AbstractFixture implements OrderedFixtureInterfac
) )
; ;
if (count($comments) > 0 && mt_rand(0, 1)) { if (count($comments) > 0 && \random_int(0, 1)) {
$comment->setParent($comments[mt_rand(0, count($comments) - 1)]); $comment->setParent($comments[\random_int(0, count($comments) - 1)]);
} }
$post->addComment($comment); $post->addComment($comment);

View file

@ -1,16 +1,17 @@
<?php <?php
declare(strict_types=1);
namespace src\PointToolsBundle\DataFixtures\ORM; namespace App\DataFixtures;
use Doctrine\Common\DataFixtures\{AbstractFixture, OrderedFixtureInterface}; use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use src\PointToolsBundle\Entity\{Blogs\Post}; use Doctrine\Persistence\ObjectManager;
use src\PointToolsBundle\DataFixtures\ORM\LoadUserData; use App\Entity\Blog\Post;
use src\PointToolsBundle\Entity\User; use App\Entity\User;
class LoadPostData extends AbstractFixture implements OrderedFixtureInterface class LoadPostData extends Fixture implements OrderedFixtureInterface
{ {
public const POST_ID_LONG = 'longpost'; private const POST_ID_LONG = 'longpost';
public const POST_ID_SHORT = 'shortpost'; public const POST_ID_SHORT = 'shortpost';
public const POST_ID_PR_USER = 'prusrpst'; public const POST_ID_PR_USER = 'prusrpst';
public const POST_ID_WL_USER = 'wlusrpst'; public const POST_ID_WL_USER = 'wlusrpst';

View file

@ -1,18 +1,17 @@
<?php <?php
declare(strict_types=1);
namespace src\PointToolsBundle\DataFixtures\ORM; namespace App\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
use src\PointToolsBundle\Entity\Subscription; use App\Entity\{Subscription, SubscriptionEvent, User};
use src\PointToolsBundle\Entity\SubscriptionEvent;
use src\PointToolsBundle\Entity\User;
/** /**
* Load user subscriptions * Load user subscriptions
*/ */
class LoadSubscribersData extends AbstractFixture implements OrderedFixtureInterface class LoadSubscribersData extends Fixture implements OrderedFixtureInterface
{ {
public function load(ObjectManager $om) public function load(ObjectManager $om)
{ {

View file

@ -1,13 +1,14 @@
<?php <?php
declare(strict_types=1);
namespace src\PointToolsBundle\DataFixtures\ORM; namespace App\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
use src\PointToolsBundle\Entity\User; use App\Entity\User;
class LoadUserData extends AbstractFixture implements OrderedFixtureInterface class LoadUserData extends Fixture implements OrderedFixtureInterface
{ {
public const USER_MAIN_ID = 99999; public const USER_MAIN_ID = 99999;
public const USER_SCND_ID = 99998; public const USER_SCND_ID = 99998;

View file

@ -22,6 +22,18 @@
"src/Repository/.gitignore" "src/Repository/.gitignore"
] ]
}, },
"doctrine/doctrine-fixtures-bundle": {
"version": "3.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.0",
"ref": "1f5514cfa15b947298df4d771e694e578d4c204d"
},
"files": [
"src/DataFixtures/AppFixtures.php"
]
},
"doctrine/doctrine-migrations-bundle": { "doctrine/doctrine-migrations-bundle": {
"version": "3.2", "version": "3.2",
"recipe": { "recipe": {