mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
192 lines
3.2 KiB
PHP
192 lines
3.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2013 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Model\Entities;
|
|
|
|
use Alchemy\Phrasea\Application;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Gedmo\Mapping\Annotation as Gedmo;
|
|
|
|
/**
|
|
* @ORM\Table(name="LazaretSessions")
|
|
* @ORM\Entity
|
|
*/
|
|
class LazaretSession
|
|
{
|
|
/**
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\Column(type="integer", nullable=true)
|
|
*/
|
|
private $usr_id;
|
|
|
|
/**
|
|
* @Gedmo\Timestampable(on="create")
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
private $created;
|
|
|
|
/**
|
|
* @Gedmo\Timestampable(on="update")
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
private $updated;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="LazaretFile", mappedBy="session", cascade={"all"})
|
|
* @ORM\OrderBy({"id" = "ASC"})
|
|
*/
|
|
private $files;
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->files = new \Doctrine\Common\Collections\ArrayCollection();
|
|
}
|
|
|
|
/**
|
|
* Get id
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Set usr_id
|
|
*
|
|
* @param integer $usrId
|
|
* @return LazaretSession
|
|
*/
|
|
public function setUsrId($usrId)
|
|
{
|
|
$this->usr_id = $usrId;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get usr_id
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getUsrId()
|
|
{
|
|
return $this->usr_id;
|
|
}
|
|
|
|
/**
|
|
* Get user
|
|
*
|
|
* @return \User_Adapter
|
|
*/
|
|
public function getUser(Application $app)
|
|
{
|
|
$user = null;
|
|
|
|
try {
|
|
$user = \User_Adapter::getInstance($this->usr_id, $app);
|
|
} catch (\Exception $e) {
|
|
|
|
}
|
|
|
|
return $user;
|
|
}
|
|
|
|
/**
|
|
* Set created
|
|
*
|
|
* @param \DateTime $created
|
|
* @return LazaretSession
|
|
*/
|
|
public function setCreated(\DateTime $created)
|
|
{
|
|
$this->created = $created;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get created
|
|
*
|
|
* @return \DateTime
|
|
*/
|
|
public function getCreated()
|
|
{
|
|
return $this->created;
|
|
}
|
|
|
|
/**
|
|
* Set updated
|
|
*
|
|
* @param \DateTime $updated
|
|
* @return LazaretSession
|
|
*/
|
|
public function setUpdated(\DateTime $updated)
|
|
{
|
|
$this->updated = $updated;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get updated
|
|
*
|
|
* @return \DateTime
|
|
*/
|
|
public function getUpdated()
|
|
{
|
|
return $this->updated;
|
|
}
|
|
|
|
/**
|
|
* Add files
|
|
*
|
|
* @param LazaretFile $files
|
|
* @return LazaretSession
|
|
*/
|
|
public function addFile(LazaretFile $files)
|
|
{
|
|
$this->files[] = $files;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Remove files
|
|
*
|
|
* @param LazaretFile $files
|
|
*/
|
|
public function removeFile(LazaretFile $files)
|
|
{
|
|
$this->files->removeElement($files);
|
|
}
|
|
|
|
/**
|
|
* Get files
|
|
*
|
|
* @return \Doctrine\Common\Collections\Collection
|
|
*/
|
|
public function getFiles()
|
|
{
|
|
return $this->files;
|
|
}
|
|
}
|