PHP code example of oliver-hader / session-service

1. Go to this page and download the library: Download oliver-hader/session-service 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/ */

    

oliver-hader / session-service example snippets


class Customer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    /**
     * Frontend User
     *
     * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
     */
    protected $user;

$currentCustomer = SubjectResolver::get()
    ->forClassName(Customer::class)
    ->forPropertyName('user')
    ->resolve();

$frontendUser = FrontendUserResolver::get()
    ->forClassName(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class)
    ->resolve();

/** @var $entity \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */
$entity = $this->entityRepository->findByIdentifier(123);
$collection = SubjectCollection::get('project/shopping-cart');
$collection[] = $entity;
$collection->persist();