PHP code example of appio-digital / redmine-passage-nette

1. Go to this page and download the library: Download appio-digital/redmine-passage-nette 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/ */

    

appio-digital / redmine-passage-nette example snippets


class LoggedUserProvider implements RedmineResourceProviderInterface
{
    /** @var UserRepo */
    private $userRepository;

    /** @var User */
    private $netteUser;

    /**
     * @param UserRepo $userRepository
     * @param User $netteUser
     */
    public function __construct(UserRepo $userRepository, User $netteUser)
    {
        $this->userRepository = $userRepository;
        $this->netteUser = $netteUser;
    }

    /**
     * @return RedmineResourceKeyInterface|null
     */
    public function getResource(): ?RedmineResourceKeyInterface
    {
        return $this->userRepository->find($this->netteUser->getId());
    }
}


class User implements RedmineResourceKeyInterface
{
    /**
     * @var string
     * @ORM\Column(type="string", nullable=true, unique=true)
     */
    private $redmineApiKey;

    /**
     * @return string
     */
    public function getRedmineApiKey(): string
    {
        return $this->redmineApiKey ?? '';
    }
}