parent
543b5e973a
commit
50f5c546ec
@ -1,7 +1,21 @@ |
||||
api_platform: |
||||
title: Chamilo |
||||
mapping: |
||||
paths: ['%kernel.project_dir%/src/CoreBundle/Entity', '%kernel.project_dir%/src/CourseBundle/Entity'] |
||||
patch_formats: |
||||
json: ['application/merge-patch+json'] |
||||
swagger: |
||||
versions: [3] |
||||
formats: |
||||
jsonld: |
||||
mime_types: |
||||
- application/ld+json |
||||
json: |
||||
mime_types: |
||||
- application/json |
||||
html: |
||||
mime_types: |
||||
- text/html |
||||
csv: |
||||
mime_types: |
||||
- text/csv |
||||
|
||||
@ -1,37 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Gedmo\Timestampable\Traits\TimestampableEntity; |
||||
|
||||
/** |
||||
* @ORM\Entity |
||||
* @ORM\Table(name="resource_tag") |
||||
*/ |
||||
class ResourceTag |
||||
{ |
||||
use TimestampableEntity; |
||||
|
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @var string |
||||
* |
||||
* @ORM\Column(name="name", type="string", nullable=false) |
||||
*/ |
||||
protected $name; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") |
||||
* @ORM\JoinColumn(name="author_id", referencedColumnName="id", onDelete="SET NULL") |
||||
*/ |
||||
protected $author; |
||||
} |
||||
@ -1,36 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity\Resource; |
||||
|
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Gedmo\Timestampable\Traits\TimestampableEntity; |
||||
|
||||
/** |
||||
* @ORM\Entity |
||||
* @ORM\Table(name="resource_user_tag") |
||||
*/ |
||||
class ResourceUserTag |
||||
{ |
||||
use TimestampableEntity; |
||||
|
||||
/** |
||||
* @ORM\Id |
||||
* @ORM\Column(type="integer") |
||||
* @ORM\GeneratedValue(strategy="AUTO") |
||||
*/ |
||||
protected $id; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") |
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL") |
||||
*/ |
||||
protected $user; |
||||
|
||||
/** |
||||
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceTag") |
||||
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="SET NULL") |
||||
*/ |
||||
protected $tag; |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Traits; |
||||
|
||||
use Carbon\Carbon; |
||||
use Symfony\Component\Serializer\Annotation\Groups; |
||||
|
||||
trait TimestampableAgoTrait |
||||
{ |
||||
/** |
||||
* @Groups({"api"}) |
||||
*/ |
||||
public function getCreatedAtAgo(): string |
||||
{ |
||||
return Carbon::instance($this->getCreatedAt())->diffForHumans(); |
||||
} |
||||
|
||||
/** |
||||
* @Groups({"api"}) |
||||
*/ |
||||
public function getUpdatedAtAgo(): string |
||||
{ |
||||
return Carbon::instance($this->getUpdatedAt())->diffForHumans(); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue