sonata-project / SonataNotificationBundle

Compare d6e738b ... +8 ... 83159c6

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -138,14 +138,16 @@
Loading
138 138
            if ($input->getOption('iteration') && $i >= (int) $input->getOption('iteration')) {
139 139
                $output->writeln('End of iteration cycle');
140 140
141 -
                return;
141 +
                return 0;
142 142
            }
143 143
        }
144 +
145 +
        return 0;
144 146
    }
145 147
146 148
    /**
147 149
     * @param string $type
148 -
     * @param string $backend
150 +
     * @param object $backend
149 151
     *
150 152
     * @throws \RuntimeException
151 153
     */

@@ -18,10 +18,11 @@
Loading
18 18
use Nelmio\ApiDocBundle\Annotation\Model;
19 19
use Nelmio\ApiDocBundle\Annotation\Operation;
20 20
use Sonata\DatagridBundle\Pager\PagerInterface;
21 -
use Sonata\NotificationBundle\Model\MessageInterface;
21 +
use Sonata\NotificationBundle\Form\Type\MessageSerializationType;
22 22
use Sonata\NotificationBundle\Model\MessageManagerInterface;
23 23
use Swagger\Annotations as SWG;
24 24
use Symfony\Component\Form\FormFactoryInterface;
25 +
use Symfony\Component\Form\FormInterface;
25 26
use Symfony\Component\HttpFoundation\Request;
26 27
27 28
/**
@@ -147,19 +148,19 @@
Loading
147 148
     *
148 149
     * @Rest\View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)
149 150
     *
150 -
     * @return MessageInterface
151 +
     * @return FormInterface
151 152
     */
152 153
    public function postMessageAction(Request $request)
153 154
    {
154 155
        $message = null;
155 156
156 -
        $form = $this->formFactory->createNamed('', 'sonata_notification_api_form_message', $message, [
157 +
        $form = $this->formFactory->createNamed('', MessageSerializationType::class, $message, [
157 158
            'csrf_protection' => false,
158 159
        ]);
159 160
160 161
        $form->handleRequest($request);
161 162
162 -
        if ($form->isValid()) {
163 +
        if ($form->isSubmitted() && $form->isValid()) {
163 164
            $message = $form->getData();
164 165
            $this->messageManager->save($message);
165 166

@@ -17,9 +17,10 @@
Loading
17 17
use FOS\RestBundle\Request\ParamFetcherInterface;
18 18
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
19 19
use Sonata\DatagridBundle\Pager\PagerInterface;
20 -
use Sonata\NotificationBundle\Model\MessageInterface;
20 +
use Sonata\NotificationBundle\Form\Type\MessageSerializationType;
21 21
use Sonata\NotificationBundle\Model\MessageManagerInterface;
22 22
use Symfony\Component\Form\FormFactoryInterface;
23 +
use Symfony\Component\Form\FormInterface;
23 24
use Symfony\Component\HttpFoundation\Request;
24 25
25 26
/**
@@ -102,19 +103,19 @@
Loading
102 103
     *
103 104
     * @param Request $request A Symfony request
104 105
     *
105 -
     * @return MessageInterface
106 +
     * @return FormInterface
106 107
     */
107 108
    public function postMessageAction(Request $request)
108 109
    {
109 110
        $message = null;
110 111
111 -
        $form = $this->formFactory->createNamed(null, 'sonata_notification_api_form_message', $message, [
112 +
        $form = $this->formFactory->createNamed('', MessageSerializationType::class, $message, [
112 113
            'csrf_protection' => false,
113 114
        ]);
114 115
115 116
        $form->handleRequest($request);
116 117
117 -
        if ($form->isValid()) {
118 +
        if ($form->isSubmitted() && $form->isValid()) {
118 119
            $message = $form->getData();
119 120
            $this->messageManager->save($message);
120 121

@@ -72,7 +72,7 @@
Loading
72 72
            if (0 === \count($messages)) {
73 73
                $output->writeln('Nothing to restart, bye.');
74 74
75 -
                return;
75 +
                return 0;
76 76
            }
77 77
        }
78 78
@@ -100,6 +100,8 @@
Loading
100 100
        }
101 101
102 102
        $output->writeln('<info>Done!</info>');
103 +
104 +
        return 0;
103 105
    }
104 106
105 107
    /**

@@ -20,6 +20,9 @@
Loading
20 20
use Sonata\AdminBundle\Show\ShowMapper;
21 21
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
22 22
23 +
/**
24 +
 * @phpstan-extends AbstractAdmin<\Sonata\NotificationBundle\Model\Message>
25 +
 */
23 26
class MessageAdmin extends AbstractAdmin
24 27
{
25 28
    protected $classnameLabel = 'Message';
@@ -81,6 +84,9 @@
Loading
81 84
82 85
        $filter
83 86
            ->add('type')
84 -
            ->add('state', null, [], ChoiceType::class, ['choices' => $class::getStateList()]);
87 +
            ->add('state', null, [
88 +
                'field_type' => ChoiceType::class,
89 +
                'field_options' => ['choices' => $class::getStateList()],
90 +
            ]);
85 91
    }
86 92
}

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Complexity Coverage
src ø -0.24% 58.34%
Project Totals (39 files) 415 58.34%
Loading