mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 11:17:58 +00:00 
			
		
		
		
	Added draft for history
This commit is contained in:
		
							
								
								
									
										35
									
								
								application/symfony/src/Attribut/LogsAttribut.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								application/symfony/src/Attribut/LogsAttribut.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Attribut;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Infinito\Entity\Meta\History\LogInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 *
 | 
			
		||||
 * @see LogsAttributInterface
 | 
			
		||||
 */
 | 
			
		||||
trait LogsAttribut
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var Collection|LogInterface[]
 | 
			
		||||
     */
 | 
			
		||||
    protected $logs;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Collection|LogInterface[] $logs
 | 
			
		||||
     */
 | 
			
		||||
    public function setLogs(Collection $logs): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->logs = $logs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return Collection|LogInterface[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getLogs(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->logs;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								application/symfony/src/Attribut/LogsAttributInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								application/symfony/src/Attribut/LogsAttributInterface.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Attribut;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Infinito\Entity\Meta\History\LogInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
interface LogsAttributInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    const LOGS_ATTRIBUT_NAME = 'logs';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Collection|LogInterface[] $logs
 | 
			
		||||
     */
 | 
			
		||||
    public function setLogs(Collection $logs): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return Collection|LogInterface[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getLogs(): Collection;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								application/symfony/src/Attribut/TimestampAttribut.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								application/symfony/src/Attribut/TimestampAttribut.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Attribut;
 | 
			
		||||
 | 
			
		||||
use Infinito\Exception\AllreadySetException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 *
 | 
			
		||||
 * @see TimestampAttributInterface
 | 
			
		||||
 */
 | 
			
		||||
trait TimestampAttribut
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \DateTime
 | 
			
		||||
     */
 | 
			
		||||
    protected $timestamp;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param \DateTime $datetime
 | 
			
		||||
     */
 | 
			
		||||
    public function setTimestamp(\DateTime $timestamp): void
 | 
			
		||||
    {
 | 
			
		||||
        if (isset($this->timestamp)) {
 | 
			
		||||
            throw new AllreadySetException('The timestamp is allready set. An Update is not possible!');
 | 
			
		||||
        }
 | 
			
		||||
        $this->timestamp = $timestamp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return \DateTime
 | 
			
		||||
     */
 | 
			
		||||
    public function getTimestamp(): \DateTime
 | 
			
		||||
    {
 | 
			
		||||
        return $this->timestamp;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Attribut;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
interface TimestampAttributInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    const TIMESTAMP_ATTRIBUT_NAME = 'timestamp';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param \DateTime $datetime
 | 
			
		||||
     */
 | 
			
		||||
    public function setTimestamp(\DateTime $timestamp): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return \DateTime
 | 
			
		||||
     */
 | 
			
		||||
    public function getTimestamp(): \DateTime;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								application/symfony/src/Entity/Meta/History/Journal.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								application/symfony/src/Entity/Meta/History/Journal.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Entity\Meta\History;
 | 
			
		||||
 | 
			
		||||
use Infinito\Entity\Meta\AbstractMeta;
 | 
			
		||||
use Infinito\Attribut\LogsAttribut;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
final class Journal extends AbstractMeta implements JournalInterface
 | 
			
		||||
{
 | 
			
		||||
    use LogsAttribut;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Entity\Meta\History;
 | 
			
		||||
 | 
			
		||||
use Infinito\Attribut\LogsAttributInterface;
 | 
			
		||||
use Infinito\Entity\Meta\MetaInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Containes the logs with the action which are comited to a source.
 | 
			
		||||
 *
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
interface JournalInterface extends LogsAttributInterface, MetaInterface
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								application/symfony/src/Entity/Meta/History/LogInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								application/symfony/src/Entity/Meta/History/LogInterface.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Entity\Meta\History;
 | 
			
		||||
 | 
			
		||||
use Infinito\Entity\EntityInterface;
 | 
			
		||||
use Infinito\Attribut\ActionTypeAttributInterface;
 | 
			
		||||
use Infinito\Attribut\RecieverAttributInterface;
 | 
			
		||||
use Infinito\Attribut\SourceAttributInterface;
 | 
			
		||||
use Infinito\Attribut\TimestampAttributInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Containes a log entry to every request wich is handled by infinito.
 | 
			
		||||
 *
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
interface LogInterface extends EntityInterface, ActionTypeAttributInterface, RecieverAttributInterface, SourceAttributInterface, TimestampAttributInterface
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user