blob: 9683ee2e8bac07c6fb86f279e10ae6723871e8ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
namespace Studip\Cli\Commands\Base;
use SimpleCollection;
use SimpleORMap;
use Symfony\Component\VarDumper\Caster\Caster;
class TinkerCaster
{
/**
* Get an array representing the properties of a collection.
*
* @param SimpleCollection $collection
* @return array
*/
public static function castCollection(SimpleCollection $collection)
{
return [
Caster::PREFIX_VIRTUAL . 'all' => [...$collection],
];
}
/**
* Get an array representing the properties of a collection.
*
* @param SimpleORMap $collection
* @return array
*/
public static function castModel(SimpleORMap $model)
{
return [
Caster::PREFIX_VIRTUAL . 'attributes' => $model->toArray(),
];
}
}
|