1 | <?php |
||||
2 | /******************************************************************************* |
||||
3 | * This file is part of the GraphQL Bundle package. |
||||
4 | * |
||||
5 | * (c) YnloUltratech <[email protected]> |
||||
6 | * |
||||
7 | * For the full copyright and license information, please view the LICENSE |
||||
8 | * file that was distributed with this source code. |
||||
9 | ******************************************************************************/ |
||||
10 | |||||
11 | namespace Ynlo\GraphQLBundle\Mutation; |
||||
12 | |||||
13 | use Ynlo\GraphQLBundle\Model\NodeInterface; |
||||
14 | use Ynlo\GraphQLBundle\Validator\ConstraintViolationList; |
||||
15 | |||||
16 | /** |
||||
17 | * Class AddNode |
||||
18 | */ |
||||
19 | class AddNode extends AbstractMutationResolver |
||||
20 | { |
||||
21 | /** |
||||
22 | * {@inheritdoc} |
||||
23 | */ |
||||
24 | public function process(&$data) |
||||
25 | { |
||||
26 | $this->prePersist($data); |
||||
27 | foreach ($this->extensions as $extension) { |
||||
28 | $extension->prePersist($data, $this, $this->context); |
||||
29 | } |
||||
30 | |||||
31 | $this->getManager()->persist($data); |
||||
32 | $this->getManager()->flush(); |
||||
33 | |||||
34 | $this->postPersist($data); |
||||
35 | foreach ($this->extensions as $extension) { |
||||
36 | $extension->postPersist($data, $this, $this->context); |
||||
37 | } |
||||
38 | } |
||||
39 | |||||
40 | /** |
||||
41 | * {@inheritdoc} |
||||
42 | */ |
||||
43 | public function returnPayload($data, ConstraintViolationList $violations, $inputSource) |
||||
44 | { |
||||
45 | if ($violations->count()) { |
||||
46 | $data = null; |
||||
47 | } |
||||
48 | |||||
49 | $class = $this->getPayloadClass(); |
||||
50 | |||||
51 | return new $class($data, $violations->all(), $inputSource['clientMutationId'] ?? null); |
||||
52 | } |
||||
53 | |||||
54 | /** |
||||
55 | * @param NodeInterface $node |
||||
56 | */ |
||||
57 | protected function prePersist(NodeInterface $node) |
||||
0 ignored issues
–
show
|
|||||
58 | { |
||||
59 | //override |
||||
60 | } |
||||
61 | |||||
62 | /** |
||||
63 | * @param NodeInterface $node |
||||
64 | */ |
||||
65 | protected function postPersist(NodeInterface $node) |
||||
0 ignored issues
–
show
The parameter
$node is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
66 | { |
||||
67 | //override |
||||
68 | } |
||||
69 | } |
||||
70 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.