-
Notifications
You must be signed in to change notification settings - Fork 183
Symfony3 support (merged forks) #283
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
Changes from 9 commits
c15f204
6c0d24a
5a5aaf0
f502d35
e7e0ca5
e8f7956
fd2752f
c78c9a7
f824ef8
cd4d911
e3a8d89
ce904d7
1837ca1
d0c3481
f5843ea
e367a88
b865d10
946e99e
77bf522
0608251
aa9eaf5
c334607
90912fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,8 @@ | |
|
|
||
| namespace FOS\MessageBundle\FormFactory; | ||
|
|
||
| use FOS\MessageBundle\FormModel\AbstractMessage; | ||
| use Symfony\Component\Form\AbstractType; | ||
| use Symfony\Component\Form\FormFactoryInterface; | ||
| use FOS\MessageBundle\FormModel\AbstractMessage; | ||
|
|
||
| /** | ||
| * Instanciates message forms | ||
|
|
@@ -21,11 +20,11 @@ abstract class AbstractMessageFormFactory | |
| protected $formFactory; | ||
|
|
||
| /** | ||
| * The message form type | ||
| * The message form class | ||
| * | ||
| * @var AbstractType | ||
| * @var string | ||
| */ | ||
| protected $formType; | ||
| protected $formClass; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a bc break as well |
||
|
|
||
| /** | ||
| * The name of the form | ||
|
|
@@ -41,10 +40,10 @@ abstract class AbstractMessageFormFactory | |
| */ | ||
| protected $messageClass; | ||
|
|
||
| public function __construct(FormFactoryInterface $formFactory, AbstractType $formType, $formName, $messageClass) | ||
| public function __construct(FormFactoryInterface $formFactory, $formClass, $formName, $messageClass) | ||
| { | ||
| $this->formFactory = $formFactory; | ||
| $this->formType = $formType; | ||
| $this->formClass = $formClass; | ||
| $this->formName = $formName; | ||
| $this->messageClass = $messageClass; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| namespace FOS\MessageBundle\FormHandler; | ||
|
|
||
| use Symfony\Component\Form\Form; | ||
| use Symfony\Component\HttpFoundation\RequestStack; | ||
| use FOS\MessageBundle\Composer\ComposerInterface; | ||
| use FOS\MessageBundle\FormModel\AbstractMessage; | ||
| use FOS\MessageBundle\Model\ParticipantInterface; | ||
|
|
@@ -25,9 +27,9 @@ abstract class AbstractMessageFormHandler | |
|
|
||
| public function __construct(RequestStack $requestStack, ComposerInterface $composer, SenderInterface $sender, ParticipantProviderInterface $participantProvider) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bc break |
||
| { | ||
| $this->request = $requestStack->getCurrentRequest(); | ||
| $this->composer = $composer; | ||
| $this->sender = $sender; | ||
| $this->request = $requestStack->getCurrentRequest(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The request must not be retrieved in the constructor. /**
* @param Request|RequestStack $request
*/
public function __construct($request, ...) {
if ($request instanceof Request) {
@trigger_error(sprintf('Using an instance of "%s" as first parameter of "%s" is deprecated since version 1.3 and won\'t be supported in 2.0. Use an instance of "Symfony\Component\HttpFoundation\RequestStack" instead.', get_class($request), __METHOD), E_USER_DEPRECATED);
}
$this->request = $request;
// ...
}
private function getCurrentRequest() {
if ($this->request instanceof Request) {
return $this->request;
}
return $this->request->getCurrentRequest();
}
public function process() {
// ...
$request = $this->getCurrentRequest();
} |
||
| $this->composer = $composer; | ||
| $this->sender = $sender; | ||
| $this->participantProvider = $participantProvider; | ||
| } | ||
|
|
||
|
|
@@ -43,7 +45,7 @@ public function process(Form $form) | |
| return false; | ||
| } | ||
|
|
||
| $form->bind($this->request); | ||
| $form->handleRequest($this->request); | ||
|
|
||
| if ($form->isValid()) { | ||
| return $this->processValidForm($form); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,40 +6,42 @@ | |
|
|
||
| <services> | ||
|
|
||
| <service id="fos_message.new_thread_form.type.default" class="FOS\MessageBundle\FormType\NewThreadMessageFormType" public="false" /> | ||
|
|
||
| <service id="fos_message.new_thread_multiple_form.type" class="FOS\MessageBundle\FormType\NewThreadMultipleMessageFormType" public="false" /> | ||
|
|
||
| <service id="fos_message.reply_form.type.default" class="FOS\MessageBundle\FormType\ReplyMessageFormType" public="false" /> | ||
|
|
||
| <service id="fos_message.new_thread_form.factory.default" class="FOS\MessageBundle\FormFactory\NewThreadMessageFormFactory" public="false"> | ||
| <argument type="service" id="form.factory" /> | ||
| <argument type="service" id="fos_message.new_thread_form.type" /> | ||
| <argument>%fos_message.new_thread_form.class%</argument> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be managed in a compiler pass |
||
| <argument>%fos_message.new_thread_form.name%</argument> | ||
| <argument>%fos_message.new_thread_form.model%</argument> | ||
| </service> | ||
|
|
||
| <service id="fos_message.reply_form.factory.default" class="FOS\MessageBundle\FormFactory\ReplyMessageFormFactory" public="false"> | ||
| <argument type="service" id="form.factory" /> | ||
| <argument type="service" id="fos_message.reply_form.type" /> | ||
| <argument>%fos_message.reply_form.class%</argument> | ||
| <argument>%fos_message.reply_form.name%</argument> | ||
| <argument>%fos_message.reply_form.model%</argument> | ||
| </service> | ||
|
|
||
| <service id="fos_message.new_thread_form.handler.default" | ||
| class="FOS\MessageBundle\FormHandler\NewThreadMessageFormHandler" | ||
| parent="fos_message.reply_form.factory.default" | ||
| public="false" /> | ||
| <service id="fos_message.new_thread_form.handler.default" class="FOS\MessageBundle\FormHandler\NewThreadMessageFormHandler" public="false"> | ||
| <argument type="service" id="request_stack" /> | ||
| <argument type="service" id="fos_message.composer" /> | ||
| <argument type="service" id="fos_message.sender" /> | ||
| <argument type="service" id="fos_message.participant_provider" /> | ||
| </service> | ||
|
|
||
| <service id="fos_message.new_thread_multiple_form.handler" | ||
| class="FOS\MessageBundle\FormHandler\NewThreadMultipleMessageFormHandler" | ||
| parent="fos_message.reply_form.factory.default" | ||
| public="false" /> | ||
| <service id="fos_message.new_thread_multiple_form.handler" class="FOS\MessageBundle\FormHandler\NewThreadMultipleMessageFormHandler" public="false"> | ||
| <argument type="service" id="request_stack" /> | ||
| <argument type="service" id="fos_message.composer" /> | ||
| <argument type="service" id="fos_message.sender" /> | ||
| <argument type="service" id="fos_message.participant_provider" /> | ||
| </service> | ||
|
|
||
| <service id="fos_message.reply_form.handler.default" | ||
| class="FOS\MessageBundle\FormHandler\ReplyMessageFormHandler" | ||
| parent="fos_message.reply_form.factory.default" | ||
| public="false"/> | ||
| <service id="fos_message.reply_form.handler.default" class="FOS\MessageBundle\FormHandler\ReplyMessageFormHandler" public="false"> | ||
| <argument type="service" id="request_stack" /> | ||
| <argument type="service" id="fos_message.composer" /> | ||
| <argument type="service" id="fos_message.sender" /> | ||
| <argument type="service" id="fos_message.participant_provider" /> | ||
| </service> | ||
|
|
||
| <service id="fos_message.recipients_data_transformer" class="FOS\MessageBundle\DataTransformer\RecipientsDataTransformer" public="false"> | ||
| <argument type="service" id="fos_user.user_to_username_transformer" /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ class QueryFactory implements QueryFactoryInterface | |
| /** | ||
| * @var Request | ||
| */ | ||
| protected $request; | ||
| protected $request = null; | ||
|
|
||
| /** | ||
| * the query parameter containing the search term | ||
|
|
@@ -30,7 +30,7 @@ class QueryFactory implements QueryFactoryInterface | |
| */ | ||
| public function __construct(RequestStack $requestStack, $queryParameter) | ||
| { | ||
| $this->request = $requestStack->getCurrentRequest(); | ||
| $this->request = $requestStack->getCurrentRequest(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be implemented as described earlier |
||
| $this->queryParameter = $queryParameter; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,11 @@ | |
| */ | ||
| class ParticipantProvider implements ParticipantProviderInterface | ||
| { | ||
| /** @var TokenStorageInterface */ | ||
| /** | ||
| * The token storage | ||
| * | ||
| * @var TokenStorageInterface | ||
| */ | ||
| protected $tokenStorage; | ||
|
|
||
| public function __construct(TokenStorageInterface $tokenStorage) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a bc break, the class should support both implementations. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is clearly a bc break, we need a bc layer to keep supporting the old option