added annotation based exporter (#1831)
* added user exporter * added project exporter * added customer exporter * added activity exporter
This commit is contained in:
76
tests/Export/Spreadsheet/Entities/DemoFull.php
Normal file
76
tests/Export/Spreadsheet/Entities/DemoFull.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Export\Spreadsheet\Entities;
|
||||
|
||||
use App\Export\Annotation as Exporter;
|
||||
|
||||
/**
|
||||
* @Exporter\Order({"a-time", "publicProperty", "a-date", "something", "privateProperty"})
|
||||
* @Exporter\Expose("accessor", label="label.accessor", exp="object.accessorMethod()")
|
||||
* @Exporter\Expose("a-date", label="label.type-date", exp="object.getDateTime()", type="date")
|
||||
* @Exporter\Expose("a-time", label="label.type-time", exp="object.getDateTime()", type="time")
|
||||
*/
|
||||
class DemoFull
|
||||
{
|
||||
/**
|
||||
* @Exporter\Expose(label="label.Public-Property", type="string")
|
||||
*/
|
||||
public $publicProperty = 'public-property';
|
||||
/**
|
||||
* @Exporter\Expose("fake-name", label="label.Protected-Property", type="boolean")
|
||||
*/
|
||||
protected $protectedProperty = false;
|
||||
/**
|
||||
* @Exporter\Expose(label="label.Private-Property", type="integer")
|
||||
*/
|
||||
private $privateProperty = 123;
|
||||
|
||||
/**
|
||||
* @Exporter\Expose(label="label.Public-Method")
|
||||
*/
|
||||
public function publicMethod(): string
|
||||
{
|
||||
return 'public-method';
|
||||
}
|
||||
|
||||
/**
|
||||
* @Exporter\Expose(label="label.Protected-Method", type="datetime")
|
||||
*/
|
||||
protected function protectedMethod(): \DateTime
|
||||
{
|
||||
return new \DateTime();
|
||||
}
|
||||
|
||||
public function getDateTime(): \DateTime
|
||||
{
|
||||
return new \DateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Exporter\Expose("renamedDuration", label="label.duration", type="duration")
|
||||
*/
|
||||
protected function duration(): int
|
||||
{
|
||||
return 12345;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Exporter\Expose(name="fake-method", label="label.Private-Method", type="boolean")
|
||||
*/
|
||||
private function privateMethod(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function accessorMethod(): string
|
||||
{
|
||||
return 'accessor-method';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user