mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 12:33:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,39 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class ActivityReasonCategory
|
||||
* Class ActivityReasonCategory.
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="activityreasoncategory")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
*/
|
||||
class ActivityReasonCategory
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
@@ -48,17 +43,12 @@ class ActivityReasonCategory
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
* Array of ActivityReason
|
||||
* Array of ActivityReason.
|
||||
*
|
||||
* @var ArrayCollection
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
||||
* mappedBy="category")
|
||||
* mappedBy="category")
|
||||
*/
|
||||
private $reasons;
|
||||
|
||||
@@ -75,13 +65,23 @@ class ActivityReasonCategory
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'ActivityReasonCategory('.$this->getName('x').')';
|
||||
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* Get active.
|
||||
*
|
||||
* @return integer
|
||||
* @return bool
|
||||
*/
|
||||
public function getActive()
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
@@ -89,20 +89,9 @@ class ActivityReasonCategory
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
* Get name.
|
||||
*
|
||||
* @param array $name
|
||||
* @return ActivityReasonCategory
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @param mixed|null $locale
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -111,30 +100,32 @@ class ActivityReasonCategory
|
||||
if ($locale) {
|
||||
if (isset($this->name[$locale])) {
|
||||
return $this->name[$locale];
|
||||
} else {
|
||||
foreach ($this->name as $name) {
|
||||
if (!empty($name)) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->name as $name) {
|
||||
if (!empty($name)) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
} else {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declare a category as active (or not). When a category is set
|
||||
* as unactive, all the reason have this entity as category is also
|
||||
* set as unactive
|
||||
* set as unactive.
|
||||
*
|
||||
* @param bool $active
|
||||
*
|
||||
* @param boolean $active
|
||||
* @return ActivityReasonCategory
|
||||
*/
|
||||
public function setActive($active)
|
||||
{
|
||||
if($this->active !== $active && !$active) {
|
||||
if ($this->active !== $active && !$active) {
|
||||
foreach ($this->reasons as $reason) {
|
||||
$reason->setActive($active);
|
||||
}
|
||||
@@ -146,13 +137,16 @@ class ActivityReasonCategory
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* Set name.
|
||||
*
|
||||
* @return boolean
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityReasonCategory
|
||||
*/
|
||||
public function getActive()
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->active;
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user