Files
sterivein/core/lib/Thelia/Model/FolderDocument.php
2014-02-22 19:01:37 +01:00

66 lines
1.3 KiB
PHP

<?php
namespace Thelia\Model;
use Thelia\Model\Base\FolderDocument as BaseFolderDocument;
use Propel\Runtime\Connection\ConnectionInterface;
class FolderDocument extends BaseFolderDocument
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our parent
*/
protected function addCriteriaToPositionQuery($query)
{
$query->filterByFolder($this->getFolder());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
/**
* Set Document parent id
*
* @param int $parentId parent id
*
* @return $this
*/
public function setParentId($parentId)
{
$this->setFolderId($parentId);
return $this;
}
/**
* Get Document parent id
*
* @return int parent id
*/
public function getParentId()
{
return $this->getFolderId();
}
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"folder_id" => $this->getFolderId(),
)
);
return true;
}
}