EditButton.php
3 months ago
EditorFavorites.php
3 months ago
EditorMenuStatus.php
3 months ago
IntegrationStatus.php
3 months ago
ListColumnOrder.php
3 months ago
ListScreenOrder.php
3 months ago
OriginalColumnsRepository.php
3 months ago
TableListOrder.php
3 months ago
UserColumnOrder.php
3 months ago
TableListOrder.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Storage\Repository; |
| 6 | |
| 7 | use AC\Preferences\Preference; |
| 8 | use AC\Preferences\SiteFactory; |
| 9 | use AC\Type\TableId; |
| 10 | |
| 11 | class TableListOrder |
| 12 | { |
| 13 | |
| 14 | private Preference $storage; |
| 15 | |
| 16 | public function __construct(?int $user_id = null) |
| 17 | { |
| 18 | $this->storage = (new SiteFactory())->create('list_order', $user_id); |
| 19 | } |
| 20 | |
| 21 | public function get_order(TableId $table_id): array |
| 22 | { |
| 23 | return $this->storage->find((string)$table_id) ?: []; |
| 24 | } |
| 25 | |
| 26 | public function set_order(TableId $table_id, array $order): void |
| 27 | { |
| 28 | $this->storage->save((string)$table_id, $order); |
| 29 | } |
| 30 | } |