Sebastian Marcet 23a16de81d Fixed error on file upload when folder does not exists
Change-Id: Ic3e503178115f8f6939ae4850d3a240e2f4dda64
2018-03-13 19:46:38 -03:00

196 lines
3.8 KiB
PHP

<?php namespace models\main;
/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use models\utils\SilverstripeBaseModel;
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity(repositoryClass="repositories\main\DoctrineFolderRepository")
* @ORM\Table(name="File")
* Class File
* @package models\main
*/
class File extends SilverstripeBaseModel
{
/**
* @ORM\Column(name="Name", type="string")
*/
private $name;
/**
* @ORM\Column(name="Title", type="string")
*/
private $title;
/**
* @ORM\Column(name="ClassName", type="string")
*/
private $class_name;
/**
* @ORM\Column(name="Content", type="string")
*/
private $content;
/**
* @ORM\Column(name="Filename", type="string")
*/
private $filename;
/**
* @ORM\Column(name="ShowInSearch", type="boolean")
* @var bool
*/
private $show_in_search;
/**
* @ORM\ManyToOne(targetEntity="models\main\File")
* @ORM\JoinColumn(name="ParentID", referencedColumnName="ID")
* @var File
*/
private $parent;
/**
* @ORM\ManyToOne(targetEntity="models\main\Member")
* @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
* @var Member
*/
private $owner;
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param mixed $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return mixed
*/
public function getContent()
{
return $this->content;
}
/**
* @param mixed $content
*/
public function setContent($content)
{
$this->content = $content;
}
/**
* @return mixed
*/
public function getFilename()
{
return $this->filename;
}
/**
* @param mixed $filename
*/
public function setFilename($filename)
{
$this->filename = $filename;
}
/**
* @return bool
*/
public function isShowInSearch()
{
return $this->show_in_search;
}
/**
* @param bool $show_in_search
*/
public function setShowInSearch($show_in_search)
{
$this->show_in_search = $show_in_search;
}
/**
* @return File
*/
public function getParent()
{
return $this->parent;
}
/**
* @param File $parent
*/
public function setParent($parent)
{
$this->parent = $parent;
}
/**
* @return Member
*/
public function getOwner()
{
return $this->owner;
}
/**
* @param Member $owner
*/
public function setOwner($owner)
{
$this->owner = $owner;
}
public function __construct()
{
parent::__construct();
$this->class_name = 'File';
$this->show_in_search = true;
}
public function setImage(){
$this->class_name = 'Image';
}
public function setFolder(){
$this->class_name = 'Folder';
}
}