Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Merge ab45a8a into 82de2aa
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Jan 20, 2019
2 parents 82de2aa + ab45a8a commit 264adb0
Show file tree
Hide file tree
Showing 16 changed files with 138 additions and 164 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.* export-ignore
*.md export-ignore
tests/* export-ignore
docs/* export-ignore
tests export-ignore
docs export-ignore
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Bug.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: 🐞 Bug Report
about: Something is broken? 🔨
labels: bug, unconfirmed
---

<!--
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Feature.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: 🚀 Feature Request
about: I have a suggestion (and may want to implement it 🙂)!
labels: feature
---

## Feature Request
Expand Down
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $rules = [
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'compact_nullable_typehint' => true,
'void_return' => null,
// To be tested before insertion:
// 'strict_comparison' => true,
// 'strict_param' => true,
Expand Down
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ language: php

php:
- '7.2'
- '7.3'
- nightly

sudo: false
Expand All @@ -37,21 +38,21 @@ env:
matrix:
fast_finish: true
include:
- php: '7.2'
- php: '7.3'
env: TARGET=docs
- php: '7.2'
- php: '7.3'
env: TARGET=lint
- php: '7.2'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.2'
- php: '7.3'
env: SYMFONY=3.4.*
- php: '7.2'
- php: '7.3'
env: SYMFONY='dev-master as 3.4.x-dev'
- php: '7.2'
- php: '7.3'
env: SONATA_CORE=3.*
- php: '7.2'
- php: '7.3'
env: SONATA_CORE='dev-master as 3.x-dev'
- php: '7.2'
- php: '7.3'
env: SYMFONY_DEPRECATIONS_HELPER=0
allow_failures:
- php: nightly
Expand Down
4 changes: 4 additions & 0 deletions .travis/before_script_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash
set -ev

if [ -f before_script_test.local.sh ]
then
./before_script_test.local.sh
fi
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,24 @@ Thank them for contributing. Encourage them if you feel this is going to be long
In short, try to make them want to contribute again. If they are stuck, try to provide them with
code yourself, or ping someone who can help.

## Manual merges

Thanks to dev-kit, stable branches are regularly merged into master branches.
It is great when it works, but often, there will be git conflicts and a human
intervention will be needed. Let us assume we are working on a repository where
the stable branch is 42.x. To do the merge manually, follow these steps:
1. Fetch the latest commits: `git fetch --all`
2. Checkout the master branch, and make sure it is up to date:
`git checkout -B master origin/master`
3. Proceed with the merge: `git merge origin/42.x`
4. Fix the conflicts (if you are doing this, it is because of conflicts,
right?) `git mergetool`
5. Create a merge commit `git commit`
6. Push the result to your fork: `git push fork 42.x`
7. Create a pull request from `fork/42.x` to `origin/42.x`
8. When the PR can be merged, do not merge it. Instead, use
`git push origin 42.x`.

## Releases

### Limitations and requests
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"nelmio/api-doc-bundle": "^2.4",
"sonata-project/doctrine-orm-admin-bundle": "^3.4",
"swiftmailer/swiftmailer": "^5.0 || ^6.0",
"symfony/phpunit-bridge": "^4.1.8"
"symfony/phpunit-bridge": "^4.2"
},
"suggest": {
"guzzlehttp/guzzle": "If you want to get a status report when using the rabbitMQ backend.",
Expand Down
20 changes: 18 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# adding PhpLexer
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer

# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -40,8 +44,8 @@
master_doc = 'index'

# General information about the project.
project = u'Sonata ~ NotificationBundle'
copyright = u'2010-2015, Thomas Rabaix'
project = u''
copyright = u'2010-2019, Thomas Rabaix'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -83,9 +87,18 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# This will be used when using the shorthand notation
highlight_language = 'php'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# -- Settings for symfony doc extension ---------------------------------------------------

# enable highlighting for PHP code not between ``<?php ... ?>`` by default
lexers['php'] = PhpLexer(startinline=True)
lexers['php-annotations'] = PhpLexer(startinline=True)
lexers['php-standalone'] = PhpLexer(startinline=True)

# -- Options for HTML output ---------------------------------------------------
import sphinx_rtd_theme
Expand Down Expand Up @@ -241,3 +254,6 @@

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# Use PHP syntax highlighting in code examples by default
highlight_language='php'
9 changes: 5 additions & 4 deletions docs/reference/advanced_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ Full configuration options:
.. code-block:: yaml
# config/packages/doctrine.yaml
doctrine:
orm:
entity_managers:
Expand All @@ -110,7 +112,6 @@ Full configuration options:
SonataNotificationBundle: ~
ApplicationSonataNotificationBundle: ~
Changing AMQP transport
-----------------------

Expand All @@ -128,13 +129,13 @@ run `composer require enqueue/amqp-ext:^0.8` and change `factory_class` option i

.. code-block:: yaml
# config/packages/sonata_notification.yaml
sonata_notification:
backends:
rabbitmq:
connection:
factory_class: \Enqueue\AmqpExt\AmqpConnectionFactory
factory_class: Enqueue\AmqpExt\AmqpConnectionFactory
.. _`queue interop`: https://github.com/queue-interop/queue-interop#amqp-interop
.. _`enqueue/amqp-lib`: https://github.com/php-enqueue/enqueue-dev/blob/master/docs/transport/amqp_lib.md
Expand Down
21 changes: 12 additions & 9 deletions docs/reference/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The notification bundle comes with one command which will listen to new incoming

.. code-block:: bash
app/console sonata:notification:start --env=prod --iteration=250
bin/console sonata:notification:start --env=prod --iteration=250
This command must be started in production environment to limit memory usage produced by
debugging information.
Expand All @@ -20,10 +20,12 @@ Monitoring process : Supervisord
This command cannot be used or started as it is on a production server. The task must be supervised by a process control system.
There are many solutions available, here a solution with ``supervisord``:

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems::
Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems

.. code-block:: ini
[program:sonata_production_sonata_notification]
command=/home/org.sonata-project.demo/current/app/console sonata:notification:start --env=notification --iteration=250
command=/home/org.sonata-project.demo/current/bin/console sonata:notification:start --env=notification --iteration=250
autorestart=true
user=www-data
redirect_stderr=false
Expand All @@ -44,15 +46,14 @@ If you are deploying with Capistrano, you can restart the supervisor process wit
long run processes as each log entry will be stacked into memory. So the notification process can stop
with a memory usage error. To solve this, just create a new env called notification without this handler.


Clean up messages
-----------------

You might want to clean old messages from different backend (if ever a backend holds them):

.. code-block:: bash
app/console sonata:notification:cleanup --env=prod
bin/console sonata:notification:cleanup --env=prod
Restart erroneous messages
--------------------------
Expand All @@ -62,18 +63,20 @@ the next iteration (this command must be used for the database backend):

.. code-block:: bash
app/console sonata:notification:restart --type="xxx" --max-attempts=10
bin/console sonata:notification:restart --type="xxx" --max-attempts=10
You can get this command to run continuously with the --pulling option and you can set the delay between the time the
message has been set to error and the time the message can be reprocess with --attempt-delay option (in seconds):

.. code-block:: bash
app/console sonata:notification:restart --type="xxx" --pulling --max-attempts=10 --attempt-delay=60 --pause=500000 --batch-size=10
bin/console sonata:notification:restart --type="xxx" --pulling --max-attempts=10 --attempt-delay=60 --pause=500000 --batch-size=10
Create and publish messages
---------------------------

For testing purpose, you might want to manually create and publish messages::
For testing purpose, you might want to manually create and publish messages

... code-block:: bash

app/console sonata:notification:create-and-publish logger '{"level":"debug","message":"Hello world!"}'
bin/console sonata:notification:create-and-publish logger '{"level":"debug","message":"Hello world!"}'
66 changes: 5 additions & 61 deletions docs/reference/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,13 @@ Now, add the new ``SonataNotificationBundle`` Bundle to ``bundles.php`` file::
// config/bundles.php

return [
//...
// ...
Sonata\NotificationBundle\SonataNotificationBundle::class => ['all' => true],
];

.. note::

If you are not using Symfony Flex, you should enable bundles in your
``AppKernel.php``.

.. code-block:: php
// app/AppKernel.php
public function registerBundles()
{
return array(
// Application Bundles
new Sonata\NotificationBundle\SonataNotificationBundle(),
);
}
Configuration
-------------

.. note::

If you are not using Symfony Flex, all configuration in this section should
be added to ``app/config/config.yml``.

SonataNotificationBundle Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -85,6 +63,7 @@ You can disable the admin if you don't need it :
Doctrine Configuration
~~~~~~~~~~~~~~~~~~~~~~

Add these bundles in the config mapping definition (or enable `auto_mapping`_):

.. code-block:: yaml
Expand All @@ -105,6 +84,7 @@ Add these bundles in the config mapping definition (or enable `auto_mapping`_):
Extending the Bundle
--------------------

.. note::

You can skip this section if you are using Flex and installed a bundle
Expand All @@ -117,10 +97,6 @@ generate the correct entities for the media:
bin/console sonata:easy-extends:generate SonataNotificationBundle --dest=src --namespace_prefix=App
.. note::

If you are not using Symfony Flex, use command without ``--namespace_prefix=App``.

With provided parameters, the files are generated in ``src/Application/Sonata/NotificationBundle``.

.. note::
Expand All @@ -131,42 +107,15 @@ With provided parameters, the files are generated in ``src/Application/Sonata/No
point to a global namespace. For instance the message will be
``App\Application\Sonata\NotificationBundle\Entity\Message``.

.. note::

If you are not using Symfony Flex, the namespace will be ``Application\Sonata\NotificationBundle\Entity``.

Now, add the new ``Application`` Bundle into the ``bundles.php``::

// config/bundles.php

return [
//...
// ...
App\Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle::class => ['all' => true],
];

.. note::

If you are not using Symfony Flex, add the new ``Application`` Bundle into your
``AppKernel.php``.

.. code-block:: php
// app/AppKernel.php
class AppKernel
{
public function registerBundles()
{
return array(
// Application Bundles
// ...
new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
// ...
)
}
}
And configure ``SonataNotificationBundle`` to use the newly generated Message class:

.. code-block:: php
Expand All @@ -177,15 +126,10 @@ And configure ``SonataNotificationBundle`` to use the newly generated Message cl
class:
message: App\Application\Sonata\NotificationBundle\Entity\Message
.. note::

If you are not using Symfony Flex, add classes without the ``App\``
part and this configuration should be added to ``app/config/config.yml``

The only thing left is to update your schema:

.. code-block:: bash
php bin/console doctrine:schema:update --force
bin/console doctrine:schema:update --force
.. _`auto_mapping`: http://symfony.com/doc/2.0/reference/configuration/doctrine.html#configuration-overview
Loading

0 comments on commit 264adb0

Please sign in to comment.