Skip to content

Commit 19185bf

Browse files
committed
fixed
1 parent 93c0164 commit 19185bf

File tree

6 files changed

+65
-76
lines changed

6 files changed

+65
-76
lines changed

Diff for: admin-business/index.markdown

+5-10
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function set(ContainerInterface $container, UserAuth $userAuth)
9494
9595
switch (PlatformClass::getPlatform()){
9696
case $container->get('parameter_bag')->get('platform_admin'):
97-
$container->get('session')->set(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'), $userAuth->getId());
97+
$container->get('request_stack')->getCurrentRequest()->getSession()->set(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'), $userAuth->getId());
9898
break;
9999
default:
100100
throw new \Exception('来源溢出');
@@ -114,15 +114,10 @@ public static function get(ContainerInterface $container)
114114
{
115115
$userAuth = null;
116116
117-
/**
118-
* @var ManagerRegistry $doctrine
119-
*/
120-
$doctrine = $container->get('doctrine');
121-
122117
switch (PlatformClass::getPlatform()){
123118
case $container->get('parameter_bag')->get('platform_admin'):
124-
$user_auth_id = $container->get('session')->get(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'));
125-
$userAuth = $doctrine->getRepository(UserAuth::class)->find($user_auth_id);
119+
$user_auth_id = $container->get('request_stack')->getCurrentRequest()->getSession()->get(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'));
120+
$userAuth = ActionLoad::$globalDoctrine->getRepository(UserAuth::class)->find($user_auth_id);
126121
break;
127122
default:
128123
throw new \Exception('来源溢出');
@@ -141,7 +136,7 @@ public static function remove(ContainerInterface $container)
141136
{
142137
switch (PlatformClass::getPlatform()){
143138
case $container->get('parameter_bag')->get('platform_admin'):
144-
$container->get('session')->remove(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'));
139+
$container->get('request_stack')->getCurrentRequest()->getSession()->remove(PlatformClass::getPlatform() . $container->get('parameter_bag')->get('login_tag_session_name'));
145140
break;
146141
default:
147142
throw new \Exception('来源溢出');
@@ -183,7 +178,7 @@ private function getUserAuthService($subject_type)
183178

184179
**php.ini**
185180

186-
```apacheconfig
181+
```ini
187182
upload_max_filesize = 1024M
188183
post_max_size = 1024M
189184
```

Diff for: config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title:
33
description:
44
keys:
55
language:
6-
version: v2.0
7-
status: newest
6+
version: v3.0
7+
status: develop
88
sort: 0
99
links:
1010
-
@@ -113,5 +113,5 @@ menus:
113113

114114
parameters:
115115
symfony:
116-
version: 5.4
117-
home: https://symfony.com/doc/5.4/index.html
116+
version: 7.0
117+
home: https://symfony.com/doc/7.0/index.html

Diff for: phpzlc/business.markdown

+3-5
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ abstract class AbstractBusiness extends AbstractController
7878
public function __construct(ContainerInterface $container)
7979
{
8080
$this->container = $container;
81-
$this->em = $this->getDoctrine()->getManager();
82-
$this->conn = $this->getDoctrine()->getConnection();
81+
$this->em = ActionLoad::$globalDoctrine;
82+
$this->conn = ActionLoad::$globalConnection;
8383

8484
if(empty(self::$validation)){
85-
self::$validation = Validation::createValidatorBuilder()
86-
->enableAnnotationMapping()
87-
->getValidator();
85+
self::$validation = ActionLoad::$globalValidation;
8886
}
8987
}
9088

Diff for: phpzlc/data-fixtures.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ php bin/console doctrine:fixtures:load --append
3939
use App\Entity\Admin;
4040
use Doctrine\Bundle\FixturesBundle\Fixture;
4141
use Doctrine\Persistence\ObjectManager;
42-
use Psr\Container\ContainerInterface;
42+
use PHPZlc\PHPZlc\Bundle\Safety\ActionLoad;
4343

4444
class AdminFixtures extends Fixture
4545
{
@@ -60,7 +60,7 @@ php bin/console doctrine:fixtures:load --append
6060
->setIsSuper(true);
6161

6262

63-
(new AdminAuth($this->container))->create($admin, '123456');
63+
(new AdminAuth(ActionLoad::$globalContainer))->create($admin, '123456');
6464
}
6565
}
6666
```

Diff for: phpzlc/db/entity.markdown

+45-51
Original file line numberDiff line numberDiff line change
@@ -24,67 +24,61 @@ keys: symfony,phpzlc,entity
2424

2525
`{entityClassName}` _选填_ 未指定的话则对话式询问,询问不指定则对所有实体生效
2626

27-
2. **通常不建议使用命令行创建实体,直接创建类文件会比较便捷**
27+
1. **通常不建议使用命令行创建实体,直接创建类文件会比较便捷**
2828

29-
_下面提供了两组模版可以用于实体的创建。_
30-
_使用时请将模版中user和User部分替换。并且修改表的描述。_
29+
_下面提供了两组模版可以用于实体的创建。_
30+
_使用时请将模版中user和User部分替换。并且修改表的描述。_
3131

32-
**UUID 代码模版(推荐方式)**
32+
**UUID 代码模版(推荐方式)**
3333

34-
```php
35-
<?php
36-
namespace App\Entity;
37-
38-
use App\Repository\UserRepository;
39-
use Doctrine\ORM\Mapping as ORM;
40-
use Symfony\Component\Validator\Constraints as Assert;
34+
```php
35+
<?php
36+
namespace App\Entity;
4137

42-
/**
43-
* @ORM\Entity(repositoryClass=UserRepository::class)
44-
* @ORM\Table(name="user", options={"comment":"用户表"})
45-
*/
46-
class User
47-
{
48-
/**
49-
* @var string
50-
*
51-
* @ORM\Column(name="id", type="string")
52-
* @ORM\Id()
53-
* @ORM\GeneratedValue(strategy="CUSTOM")
54-
* @ORM\CustomIdGenerator(class="PHPZlc\PHPZlc\Doctrine\SortIdGenerator")
55-
*/
56-
private $id;
57-
}
58-
```
38+
use App\Repository\UserRepository;
39+
use Doctrine\ORM\Mapping as ORM;
40+
use Symfony\Component\Validator\Constraints as Assert;
41+
42+
#[ORM\Entity(repositoryClass: UserRepository::class)]
43+
#[ORM\Table(name: "user", options:["comment" => "用户表"])]
44+
class User
45+
{
46+
#[ORM\Id]
47+
#[ORM\Column(name: "id", type: "string")]
48+
#[ORM\GeneratedValue(strategy: "CUSTOM")]
49+
#[ORM\CustomIdGenerator(class: SortIdGenerator::class)]
50+
private ?string $id = null;
51+
}
52+
```
5953

60-
_UUID更加方便系统向分布式系统转化。_
54+
_UUID更加方便系统向分布式系统转化。_
6155

62-
_PHPZlc对UUID进行了改造,其在保持唯一性的同时,增加了如自增ID一样的排序性,缺点在于最终生成的ID较长,(如果有更好的算法,希望与我们联系)。_
56+
_PHPZlc对UUID进行了改造,其在保持唯一性的同时,增加了如自增ID一样的排序性,缺点在于最终生成的ID较长,(如果有更好的算法,希望与我们联系)。_
6357

64-
**自增ID代码模版**
58+
**自增ID代码模版**
6559

66-
```php
67-
<?php
68-
namespace App\Entity;
60+
```php
61+
<?php
62+
namespace App\Entity;
6963

70-
use App\Repository\UserRepository;
71-
use Doctrine\ORM\Mapping as ORM;
72-
use Symfony\Component\Validator\Constraints as Assert;
64+
use App\Repository\UserRepository;
65+
use Doctrine\ORM\Mapping as ORM;
66+
use Symfony\Component\Validator\Constraints as Assert;
7367

74-
/**
75-
* @ORM\Entity(repositoryClass=UserRepository::class)
76-
* @ORM\Table(name="user", options={"comment":"用户表"})
77-
*/
78-
class User
79-
{
80-
/**
81-
* @ORM\Id
82-
* @ORM\GeneratedValue
83-
* @ORM\Column(type="integer")
84-
*/
85-
private $id;
86-
}
87-
```
68+
/**
69+
* @ORM\Entity(repositoryClass=UserRepository::class)
70+
* @ORM\Table(name="user", options={"comment":"用户表"})
71+
*/
72+
class User
73+
{
74+
/**
75+
* @ORM\Id
76+
* @ORM\GeneratedValue
77+
* @ORM\Column(type="integer")
78+
*/
79+
private $id;
80+
}
81+
```
8882

8983
## 生成GetSet方法,生成RepositoryClass类
9084

Diff for: phpzlc/install.markdown

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ Symfony对于相同技术提供了多种使用途径,在教程中,所呈现的
1616

1717
## 运行环境
1818

19-
**php >=7.2.5 (推荐PHP7.3)**
19+
**php >=8.2**
2020

2121
**mysql 5.7 +**
2222

2323
**composer 2 (推荐)**
2424

25-
## 安装Symfony5.4
25+
## 安装Symfony7.0
2626

2727
```shell
28-
composer create-project symfony/website-skeleton:"^5.4" my_project_name
28+
composer create-project symfony/skeleton:"7.0.*" my_project_directory
29+
cd my_project_directory
30+
composer require webapp //该选项会安装额外的软件包以提供 构建 Web 应用程序所需的一切 通常需要安装
2931
```
3032

31-
这是Symfony5.4安装的命令,如果有疑问或者希望了解更多,请阅读官方文档[安装和设置Symfony框架](https://symfony.com/doc/5.4/setup.html)
33+
这是Symfony7.0安装的命令,如果有疑问或者希望了解更多,请阅读官方文档[安装和设置Symfony框架](https://symfony.com/doc/7.0/setup.html)
3234

3335
## PHPZlc内核安装
3436

0 commit comments

Comments
 (0)