PHP code example of tmonier / sylius-timeline-plugin
1. Go to this page and download the library: Download tmonier/sylius-timeline-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function __construct(
private TimelineEntryFactoryInterface $entryFactory,
private TimelineEntryWriterInterface $writer,
) {}
$entry = $this->entryFactory->createForOrder($order, TimelineEntryInterface::TYPE_TRANSITION, Actor::system());
$entry->setWorkflow('app_fraud_check');
$entry->setTransition('flag');
$this->writer->persist($entry); // flushed with your own changes
use Tmonier\SyliusTimelinePlugin\Gdpr\CustomerTimelineEraserInterface;
final class AnonymiseCustomerHandler
{
public function __construct(
private CustomerTimelineEraserInterface $timelineEraser,
// … your other services
) {}
public function __invoke(AnonymiseCustomer $command): void
{
$customer = $this->findCustomer($command->customerId);
// 1. Your existing anonymisation logic (replace e-mail, name, address…).
$this->customerAnonymiser->anonymise($customer);
// 2. Erase personal data from the timeline.
$this->timelineEraser->eraseForCustomer($customer);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.