/
Video.php
53 lines (46 loc) · 1.36 KB
/
Video.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace gossi\trixionary\model;
use gossi\trixionary\model\Base\Video as BaseVideo;
use gossi\trixionary\model\Map\VideoTableMap;
use gossi\trixionary\serializer\VideoSerializer;
use keeko\core\model\ActivityObject;
use keeko\framework\model\ActivityObjectInterface;
use keeko\framework\model\ApiModelInterface;
use Cocur\Slugify\Slugify;
/**
* Skeleton subclass for representing a row from the 'kk_trixionary_video' table.
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class Video extends BaseVideo implements ApiModelInterface, ActivityObjectInterface {
/**
*/
private static $serializer;
/**
* @return VideoSerializer
*/
public static function getSerializer() {
if (self::$serializer === null) {
self::$serializer = new VideoSerializer();
}
return self::$serializer;
}
/**
*/
public function getFilename() {
$slugifier = new Slugify();
return $slugifier->slugify($this->getAthlete()) . '-' . $this->getId() . '.mp4';
}
/**
*/
public function toActivityObject() {
$obj = new ActivityObject();
$obj->setType(ActivityObject::TYPE_VIDEO);
$obj->setClassName(VideoTableMap::OM_CLASS);
$obj->setDisplayName($this->getTitle());
$obj->setReferenceId($this->getId());
return $obj;
}
}