-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Victoire/feature/basic-documentation
Feature/basic documentation
- Loading branch information
Showing
7 changed files
with
213 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
# VacuumBundle | ||
|
||
Converts a wordpress dump into Victoire Blog | ||
The VacuumBundle offer an Implementation for the import of external data | ||
to populate a new or an existing Victoire Blog. | ||
|
||
## Installation | ||
|
||
Install it with composer: | ||
|
||
php composer.phar require victoire/vacuum-bundle | ||
|
||
Then add it to your AppKernel: | ||
|
||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = array( | ||
... | ||
new Victoire\DevTools\VacuumBundle\VictoireVacuumBundle(), | ||
); | ||
|
||
return $bundles; | ||
} | ||
} | ||
Finally update your schema: | ||
|
||
php bin/console doctrine:schema:update --force | ||
|
||
#### Import available | ||
|
||
| Source | Format | | ||
|-----------|--------| | ||
| WordPress | XML | | ||
|
||
### Doc | ||
|
||
1. [Basic usage](doc/basic_usage.md) | ||
1. [How it Works](doc/how_it_works.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Usage | ||
|
||
The bundle provide a new command | ||
|
||
php bin/console victoire:blog-import | ||
|
||
When using it, the command will start in interactive mod. | ||
You just have to follows th instruction. | ||
|
||
No interact mod is also available (param: --no-interact) | ||
It require some parameter: | ||
|
||
## Using an existing Article Template | ||
|
||
| option | shortcut | definition | required | | ||
|-----------------------------|----------|-----------------------------------------------------------------------------------------------------------|----------| | ||
| blog-name | -b | define the new victoire blog name | true | | ||
| blog-template | -bt | id of the base template for the new blog | true | | ||
| blog-parent-id | -bpi | id of the blog parent pages | true | | ||
| dump | -d | Path to the xml source file | true | | ||
| article-template-id | -ati | If you want to use an existing ArticleTemplate Id | false | | ||
| article-template-first-slot | -atfs | In every case you have to define the lot definition for your article content | true | | ||
|
||
## Without an Existing Article Template | ||
|
||
| option | shortcut | definition | required | | ||
|-----------------------------|----------|-----------------------------------------------------------------------------------------------------------|----------| | ||
| blog-name | -b | define the new victoire blog name | true | | ||
| blog-template | -bt | id of the base template for the new blog | true | | ||
| blog-parent-id | -bpi | id of the blog parent pages | true | | ||
| dump | -d | Path to the xml source file | true | | ||
| article-template-name | -atn | If you dont use an existing ArticleTemplate you have to provide a name for the new one | false | | ||
| article-template-layout | -atl | If you dont have an existing ArticleTemplate, you have to provide the layout designation for the new one | false | | ||
| article-template-parent-id | -atpid | If you dont have an existing ArticleTemplate, you have to provide the parent id for the new one. | false | | ||
| article-template-first-slot | -atfs | In every case you have to define the lot definition for your article content | true | | ||
|
||
|
||
When the command is execute if you have some blog author link to your article in your | ||
dump, and they have no equivalent in your bdd (an equivalent would be an user with the same email | ||
or username than your blog author). | ||
|
||
Then you will get an error associate with array containing every missing author from you bdd, you have to add it | ||
in your bdd to execute a successful import. | ||
|
||
Add the end of the command if every stages has return a success then you have to | ||
regenerate your view references manually | ||
|
||
php bin/console victoire:viewReference:generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Principle | ||
|
||
The general id behind this bundle is to offer an flexible | ||
base implementation to help in the transformation of data coming | ||
from multiple source into Victoire Blog. | ||
|
||
It's based on an php implementation of the pattern design known has | ||
pipeline. You can find this implementation [there](https://github.com/thephpleague/pipeline) | ||
|
||
A pipeline is a class implementing the following interface: | ||
|
||
interface PipelineInterface extends StageInterface | ||
{ | ||
/** | ||
* Create a new pipeline with an appended stage. | ||
* | ||
* @param callable $operation | ||
* | ||
* @return static | ||
*/ | ||
public function pipe(callable $operation); | ||
|
||
/** | ||
* Execute the processor process method | ||
* | ||
* @param $payload | ||
* | ||
* @return mixed | ||
*/ | ||
public function process($payload); | ||
} | ||
|
||
When a new Pipeline is instantiate it require a Processor. The processor is | ||
the class in charge of executing the pipeline stages chain. Basically it's just | ||
a loop who exec any callable method in the stages, passing an immutable object | ||
called a Payload from stage to stage. | ||
|
||
A processor is build based on the following interface | ||
|
||
interface ProcessorInterface | ||
{ | ||
/** | ||
* @param array $stages | ||
* @param $payload | ||
* | ||
* @return mixed | ||
*/ | ||
public function process(array $stages, $payload); | ||
} | ||
|
||
The Stages is where the business is done. It consist in a simple class using any | ||
callable method you want, who receive a payload in param and return it when is job is done. | ||
|
||
Is create by implementing the following interface | ||
|
||
interface StageInterface | ||
{ | ||
/** | ||
* @param CommandPayloadInterface $payload | ||
* | ||
* @return $payload | ||
*/ | ||
public function __invoke(CommandPayloadInterface $payload); | ||
} | ||
|
||
So once I have some stage a pipeline an a processor we can build an execution chain | ||
|
||
$pipeline = new Pipeline(new Processor()); | ||
|
||
$payload = new Payload(); | ||
|
||
$pipeline | ||
->pipe(new Stage1) | ||
->pipe(new Stage2) | ||
->pipe(new Stage3) | ||
->process($payload) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters