I have a repository with 2 applications. The first application is already up and running and has authentication and the needed logic. The second application is for me to extend the first application with 2FA support. The second application should handle everything that has to do with 2FA (sending SMS, confirmation, saving telephonenumber to db etc.) I now want to save my ExtendedUser model into the db with a corresponding repository but I don't know how to get the currently authenticated user of the first application and access it in the second application where I can save my model.
I haven't tried anything due to a lack of understanding of the framework, it's really hard to get the gist of it..
<?php
namespace One50\TwoFactorAuth\Domain\Model;
/*
* This file is part of the One50.TwoFactorAuth package.
*/
use Neos\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
use One50\Shop\Domain\Model\User;
/**
* @Flow\Entity
*/
class ExtendedUser
{
/**
* @var string
*/
protected $telephoneNumber;
/**
* @ORM\OneToOne
* @var User
*/
protected $user;
/**
* @return string
*/
public function getTelephoneNumber()
{
return $this->telephoneNumber;
}
/**
* @param string $telephoneNumber
* @return void
*/
public function setTelephoneNumber($telephoneNumber)
{
$this->telephoneNumber = $telephoneNumber;
}
}
Did you mean a package and not an application, maybe?
I don't recommend that you do this. If you have really a second application, you must share the persistence - database in both applications to extend entity by second application.
The best way is to use, is a second package if you need a separation or – better – communicate between applications like microservices do, by call command of second application from first application.
I hope I understood your question correctly.