Skip to content

Commit

Permalink
Merge pull request #476 from jan-stanek/opravy-modelu
Browse files Browse the repository at this point in the history
oprava chyb modelu
  • Loading branch information
Jan Staněk authored Jan 3, 2018
2 parents 37a71ff + 58c1276 commit d425ce5
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 144 deletions.
2 changes: 1 addition & 1 deletion app/model/ACL/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Permission

/**
* Prostředek oprávnění.
* @ORM\ManyToOne(targetEntity="\App\Model\ACL\Resource", inversedBy="permissions", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\ACL\Resource", inversedBy="permissions")
* @var Resource
*/
protected $resource;
Expand Down
8 changes: 0 additions & 8 deletions app/model/ACL/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,4 @@ public function getPermissions()
{
return $this->permissions;
}

/**
* @param Collection $permissions
*/
public function setPermissions($permissions)
{
$this->permissions = $permissions;
}
}
14 changes: 8 additions & 6 deletions app/model/ACL/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Role

/**
* Oprávnění role.
* @ORM\ManyToMany(targetEntity="Permission", inversedBy="roles", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="Permission", inversedBy="roles")
* @var Collection
*/
protected $permissions;
Expand Down Expand Up @@ -197,7 +197,7 @@ class Role

/**
* Role vyžadované touto rolí.
* @ORM\ManyToMany(targetEntity="Role", inversedBy="requiredByRole", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="Role", inversedBy="requiredByRole")
* @ORM\JoinTable(name="role_role_required",
* joinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="required_role_id", referencedColumnName="id")}
Expand Down Expand Up @@ -299,7 +299,9 @@ public function getPermissions(): Collection
*/
public function setPermissions(Collection $permissions): void
{
$this->permissions = $permissions;
$this->permissions->clear();
foreach ($permissions as $permission)
$this->permissions->add($permission);
}

public function addPermission(Permission $permission): void
Expand All @@ -318,7 +320,7 @@ public function getPages(): Collection
/**
* @param Collection $pages
*/
public function setPages(Collection $pages): void
public function setPages(Collection $pages): void //TODO kontrola
{
foreach ($this->getPages() as $page) {
if (!$pages->contains($page))
Expand Down Expand Up @@ -518,7 +520,7 @@ public function getIncompatibleRoles(): Collection
/**
* @param Collection $incompatibleRoles
*/
public function setIncompatibleRoles(Collection $incompatibleRoles): void
public function setIncompatibleRoles(Collection $incompatibleRoles): void //TODO kontrola
{
foreach ($this->getIncompatibleRoles() as $role) {
if (!$incompatibleRoles->contains($role))
Expand Down Expand Up @@ -601,7 +603,7 @@ public function getRequiredRoles(): Collection
/**
* @param Collection $requiredRoles
*/
public function setRequiredRoles(Collection $requiredRoles): void
public function setRequiredRoles(Collection $requiredRoles): void //TODO kontrola
{
$this->requiredRoles = $requiredRoles;
}
Expand Down
2 changes: 1 addition & 1 deletion app/model/CMS/Content/CapacitiesContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getRoles()
/**
* @param Collection $roles
*/
public function setRoles($roles)
public function setRoles($roles) //TODO kontrola
{
$this->roles = $roles;
}
Expand Down
2 changes: 1 addition & 1 deletion app/model/CMS/Content/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ abstract class Content implements IContent

/**
* Stránka, na které je obsah umístěn.
* @ORM\ManyToOne(targetEntity="\App\Model\CMS\Page", inversedBy="contents", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\CMS\Page", inversedBy="contents")
* @var Page
*/
protected $page;
Expand Down
4 changes: 2 additions & 2 deletions app/model/CMS/Document/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Document

/**
* Tagy dokumentu.
* @ORM\ManyToMany(targetEntity="Tag", inversedBy="documents", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="Tag", inversedBy="documents")
* @var Collection
*/
protected $tags;
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getTags()
/**
* @param Collection $tags
*/
public function setTags($tags)
public function setTags($tags) //TODO kontrola
{
$this->tags = $tags;
}
Expand Down
2 changes: 1 addition & 1 deletion app/model/CMS/Faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Faq

/**
* Autor otázky.
* @ORM\ManyToOne(targetEntity="\App\Model\User\User", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\User\User")
* @var User
*/
protected $author;
Expand Down
6 changes: 3 additions & 3 deletions app/model/CMS/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Page

/**
* Role, které mají na stránku přístup.
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role", inversedBy="pages", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role", inversedBy="pages")
* @var Collection
*/
protected $roles;
Expand Down Expand Up @@ -164,7 +164,7 @@ public function getRoles()
/**
* @param Collection $roles
*/
public function setRoles($roles)
public function setRoles($roles) //TODO kontrola
{
$this->roles = $roles;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public function hasContents($area)
/**
* @param $content
*/
public function addContent($content)
public function addContent($content) //TODO kontrola
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('area', $content->getArea()));
Expand Down
8 changes: 6 additions & 2 deletions app/model/Mailing/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public function getRecipientRoles()
*/
public function setRecipientRoles($recipientRoles)
{
$this->recipientRoles = $recipientRoles;
$this->recipientRoles->clear();
foreach ($recipientRoles as $recipientRole)
$this->recipientRoles->add($recipientRole);
}

/**
Expand Down Expand Up @@ -121,7 +123,9 @@ public function getRecipientUsers()
*/
public function setRecipientUsers($recipientUsers)
{
$this->recipientUsers = $recipientUsers;
$this->recipientUsers->clear();
foreach ($recipientUsers as $recipientUser)
$this->recipientUsers->add($recipientUser);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions app/model/Mailing/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,6 @@ public function getVariables()
return $this->variables;
}

/**
* @param Collection $variables
*/
public function setVariables($variables)
{
$this->variables = $variables;
}

/**
* @return bool
*/
Expand Down
14 changes: 3 additions & 11 deletions app/model/Program/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ class Block

/**
* Lektor.
* @ORM\ManyToOne(targetEntity="\App\Model\User\User", inversedBy="lecturersBlocks", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\User\User", inversedBy="lecturersBlocks")
* @var User
*/
protected $lector;

/**
* Kategorie bloku.
* @ORM\ManyToOne(targetEntity="Category", inversedBy="blocks", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="Category", inversedBy="blocks")
* @var Category
*/
protected $category;

/**
* Podakce bloku.
* @ORM\ManyToOne(targetEntity="\App\Model\Structure\Subevent", inversedBy="blocks", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\Structure\Subevent", inversedBy="blocks")
* @var Subevent
*/
protected $subevent;
Expand Down Expand Up @@ -141,14 +141,6 @@ public function getPrograms()
return $this->programs;
}

/**
* @param Collection $programs
*/
public function setPrograms($programs)
{
$this->programs = $programs;
}

/**
* Vrací seznam účastníků bloku.
* @return Collection
Expand Down
12 changes: 2 additions & 10 deletions app/model/Program/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Category

/**
* Role, které si mohou přihlašovat programy z kategorie.
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role", inversedBy="registerableCategories", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role", inversedBy="registerableCategories")
* @var Collection
*/
protected $registerableRoles;
Expand Down Expand Up @@ -87,7 +87,7 @@ public function getRegisterableRoles()
/**
* @param Collection $registerableRoles
*/
public function setRegisterableRoles($registerableRoles)
public function setRegisterableRoles($registerableRoles) //TODO kontrola
{
$this->registerableRoles = $registerableRoles;
}
Expand All @@ -108,12 +108,4 @@ public function getBlocks()
{
return $this->blocks;
}

/**
* @param Collection $blocks
*/
public function setBlocks($blocks)
{
$this->blocks = $blocks;
}
}
11 changes: 4 additions & 7 deletions app/model/Program/Program.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Program

/**
* Programový blok.
* @ORM\ManyToOne(targetEntity="Block", inversedBy="programs", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="Block", inversedBy="programs")
* @var Block
*/
protected $block;
Expand All @@ -37,7 +37,7 @@ class Program

/**
* Místnost.
* @ORM\ManyToOne(targetEntity="Room", inversedBy="programs", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="Room", inversedBy="programs")
* @var Room
*/
protected $room;
Expand Down Expand Up @@ -96,20 +96,17 @@ public function getAttendees()
public function setAttendees(Collection $attendees)
{
$this->removeAllAttendees();
foreach ($attendees as $attendee) {
foreach ($attendees as $attendee)
$this->addAttendee($attendee);
}
}

/**
* @param $user
*/
public function addAttendee(User $user)
{
if (!$this->attendees->contains($user)) {
$this->attendees->add($user);
if (!$this->attendees->contains($user))
$user->addProgram($this);
}
}

/**
Expand Down
8 changes: 0 additions & 8 deletions app/model/Program/Room.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,4 @@ public function getPrograms()
{
return $this->programs;
}

/**
* @param mixed $programs
*/
public function setPrograms($programs)
{
$this->programs = $programs;
}
}
8 changes: 0 additions & 8 deletions app/model/Settings/CustomInput/CustomInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,4 @@ public function getCustomInputValues()
{
return $this->customInputValues;
}

/**
* @param Collection $customInputValues
*/
public function setCustomInputValues($customInputValues)
{
$this->customInputValues = $customInputValues;
}
}
12 changes: 2 additions & 10 deletions app/model/Structure/Subevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Subevent

/**
* Podakce vyžadované touto podakcí.
* @ORM\ManyToMany(targetEntity="Subevent", inversedBy="requiredBySubevent", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="Subevent", inversedBy="requiredBySubevent")
* @ORM\JoinTable(name="subevent_subevent_required",
* joinColumns={@ORM\JoinColumn(name="subevent_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="required_subevent_id", referencedColumnName="id")}
Expand Down Expand Up @@ -155,14 +155,6 @@ public function getBlocks() : Collection
return $this->blocks;
}

/**
* @param Collection $blocks
*/
public function setBlocks(Collection $blocks) : void
{
$this->blocks = $blocks;
}

/**
* @return int
*/
Expand Down Expand Up @@ -298,7 +290,7 @@ public function getRequiredSubevents() : Collection
/**
* @param $requiredSubevents
*/
public function setRequiredSubevents(Collection $requiredSubevents) : void
public function setRequiredSubevents(Collection $requiredSubevents) : void //TODO kontrola
{
$this->requiredSubevents = $requiredSubevents;
}
Expand Down
2 changes: 1 addition & 1 deletion app/model/User/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract class Application

/**
* Role.
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role")
* @ORM\ManyToMany(targetEntity="\App\Model\ACL\Role", cascade={"persist"})
* @var Collection
*/
protected $roles;
Expand Down
4 changes: 2 additions & 2 deletions app/model/User/CustomInputValue/CustomInputValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ abstract class CustomInputValue

/**
* Vlastní pole přihlášky.
* @ORM\ManyToOne(targetEntity="\App\Model\Settings\CustomInput\CustomInput", inversedBy="customInputValues", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\Settings\CustomInput\CustomInput", inversedBy="customInputValues")
* @var CustomInput
*/
protected $input;

/**
* Uživatel.
* @ORM\ManyToOne(targetEntity="\App\Model\User\User", inversedBy="customInputValues", cascade={"persist"})
* @ORM\ManyToOne(targetEntity="\App\Model\User\User", inversedBy="customInputValues")
* @var User
*/
protected $user;
Expand Down
Loading

0 comments on commit d425ce5

Please sign in to comment.