PHP code example of alpsify / reset-password-api-bundle
1. Go to this page and download the library: Download alpsify/reset-password-api-bundle 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/ */
alpsify / reset-password-api-bundle example snippets
// src/Entity/ResetPasswordRequest.php
use Alpsify\ResetPasswordAPIBundle\Model\AbstractResetPasswordRequest;
use App\Repository\ResetPasswordRequestRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ResetPasswordRequestRepository::class)
*/
class ResetPasswordRequest extends AbstractResetPasswordRequest
{
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Accountant::class)
* @ORM\JoinColumn(nullable=true)
*/
private $accountant;
/**
* @ORM\ManyToOne(targetEntity=Client::class)
* @ORM\JoinColumn(nullable=true)
*/
private $client;
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user): void
{
$this->user = $user;
}
/**
* @return Accountant|object
*/
public function getAccountant()
{
return $this->accountant;
}
/**
* @param Accountant|object $accountant
*/
public function setAccountant($accountant): void
{
$this->accountant = $accountant;
}
/**
* @return Client|object
*/
public function getClient()
{
return $this->client;
}
/**
* @param Client|object $client
*/
public function setClient($client): void
{
$this->client = $client;
}
public function registerUser(object $user): void
{
if($user instanceof User) {
$this->user = $user;
} elseif ($user instanceof Accountant) {
$this->accountant = $user;
} elseif ($user instanceof Client) {
$this->client = $user;
}
}
public function fetchUser(): object
{
if($this->user) {
return $this->user;
} elseif ($this->accountant) {
return $this->accountant;
} elseif ($this->client) {
return $this->client;
}
}
}
// App/Repository/ResetPasswordRequestRepository.php
use Alpsify\ResetPasswordAPIBundle\Persistence\Repository\ResetPasswordRequestRepositoryInterface;
use Alpsify\ResetPasswordAPIBundle\Persistence\Repository\ResetPasswordRequestRepositoryTrait;
use App\Entity\ResetPasswordRequest;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class ResetPasswordRequestRepository extends ServiceEntityRepository implements ResetPasswordRequestRepositoryInterface
{
use ResetPasswordRequestRepositoryTrait;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ResetPasswordRequest::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.