Applied php-cs-fixer and added some @PHPDoc
Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -69,7 +69,6 @@ class DefaultController extends Controller
|
||||
public function groupJoinDeclineAction()
|
||||
{
|
||||
// TODO: A reason must be written to decline a join request!
|
||||
|
||||
return array(
|
||||
);
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
||||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,8 @@ class BookController extends Controller
|
||||
* @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true})
|
||||
* @Template()
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
*/
|
||||
public function ajaxDataAction(Book $book)
|
||||
{
|
||||
@@ -43,13 +45,14 @@ class BookController extends Controller
|
||||
/**
|
||||
* @Route("/konyv/torles/{id}", name="KekRozsakFrontBundle_bookDeleteCopy", requirements={"id": "\d+"}, options={"expose": true})
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
*/
|
||||
public function ajaxDeleteBookAction(Book $book)
|
||||
{
|
||||
$copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser());
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$copies->forAll(function($key, $copy) use ($book, $em)
|
||||
{
|
||||
$copies->forAll(function($key, $copy) use ($book, $em) {
|
||||
$book->removeCopy($copy);
|
||||
$em->remove($copy);
|
||||
});
|
||||
@@ -62,6 +65,8 @@ class BookController extends Controller
|
||||
/**
|
||||
* @Route("/konyv/ujpeldany/{id}", name="KekRozsakFrontBundle_bookAddCopy", requirements={"id": "\d+"}, options={"expose": true})
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
*/
|
||||
public function ajaxAddCopyAction(Book $book)
|
||||
{
|
||||
@@ -80,14 +85,16 @@ class BookController extends Controller
|
||||
/**
|
||||
* @Route("/konyv/kolcsonozheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyBorrowable", requirements={"id": "\d+"}, options={"expose": true})
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
* @param boolean $newValue
|
||||
*/
|
||||
public function ajaxSetBookCopyBorrowableAction(Book $book, $newValue)
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$copies = $book->getUsersCopies($user);
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$copies->forAll(function($key, $copy) use ($em, $newValue)
|
||||
{
|
||||
$copies->forAll(function($key, $copy) use ($em, $newValue) {
|
||||
$copy->setBorrowable($newValue);
|
||||
$em->persist($copy);
|
||||
});
|
||||
@@ -99,14 +106,16 @@ class BookController extends Controller
|
||||
/**
|
||||
* @Route("/konyv/megveheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyForSale", requirements={"id": "\d+"}, options={"expose": true})
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
* @param boolean $newValue
|
||||
*/
|
||||
public function ajaxSetBookCopyForSaleAction(Book $book, $newValue)
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$copies = $book->getUsersCopies($user);
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$copies->forAll(function($key, $copy) use ($em, $newValue)
|
||||
{
|
||||
$copies->forAll(function($key, $copy) use ($em, $newValue) {
|
||||
$copy->setBuyable($newValue);
|
||||
$em->persist($copy);
|
||||
});
|
||||
@@ -118,6 +127,9 @@ class BookController extends Controller
|
||||
/**
|
||||
* @Route("/konyv/szeretnek/{id}/{wantToBuy}", name="KekRozsakFrontBundle_bookWantOne", requirements={"id": "\d+"}, options={"expose": true})
|
||||
* @ParamConverter("book")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Book $book
|
||||
* @param boolean $wantToBuy
|
||||
*/
|
||||
public function ajaxWantABookAction(Book $book, $wantToBuy)
|
||||
{
|
||||
|
@@ -5,10 +5,7 @@ namespace KekRozsak\FrontBundle\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\UserGroupMembership;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
use KekRozsak\FrontBundle\Entity\Article;
|
||||
|
||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
|
||||
|
@@ -17,6 +17,9 @@ class DocumentController extends Controller
|
||||
* @Route("/dokumentum/{slug}.{_format}", name="KekRozsakFrontBundle_documentView", defaults={"_format": "html"}, requirements={"_format": "html|pdf"})
|
||||
* @Template()
|
||||
* @ParamConverter("document")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
* @param string $_format
|
||||
*/
|
||||
public function viewAction(Document $document, $_format)
|
||||
{
|
||||
@@ -29,6 +32,7 @@ class DocumentController extends Controller
|
||||
'KekRozsakFrontBundle:Document:pdfView.html.twig',
|
||||
$templateParams
|
||||
);
|
||||
|
||||
return $this->get('io_tcpdf')->quick_pdf($html);
|
||||
}
|
||||
|
||||
@@ -78,6 +82,8 @@ class DocumentController extends Controller
|
||||
* @Route("/dokumentum/{slug}/szerkesztes", name="KekRozsakFrontBundle_documentEdit")
|
||||
* @Template()
|
||||
* @ParamConverter("document")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
*/
|
||||
public function editAction(Document $document)
|
||||
{
|
||||
|
@@ -17,6 +17,10 @@ class EventController extends Controller
|
||||
* @Template()
|
||||
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug" = "slug", "startDate"="startDate"}})
|
||||
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
|
||||
*
|
||||
* @param DateTime $startDate
|
||||
* @param KekRozsak\FrontBundle\Entity\Event $event
|
||||
* @return array
|
||||
*/
|
||||
public function viewAction(\DateTime $startDate, Event $event)
|
||||
{
|
||||
@@ -36,6 +40,10 @@ class EventController extends Controller
|
||||
* @Template()
|
||||
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug": "slug", "startDate": "startDate"}})
|
||||
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"})
|
||||
*
|
||||
* @param DateTime $startDate
|
||||
* @param KekRozsak\FrontBundle\Entity\Event $event
|
||||
* @return array
|
||||
*/
|
||||
public function joinAction(\DateTime $startDate, Event $event)
|
||||
{
|
||||
@@ -62,6 +70,9 @@ class EventController extends Controller
|
||||
/**
|
||||
* @Route("/esemenyek/{date}", name="KekRozsakFrontBundle_eventList", defaults={"date": null})
|
||||
* @Template()
|
||||
*
|
||||
* @param string $date
|
||||
* @return array
|
||||
*/
|
||||
public function listAction($date = null)
|
||||
{
|
||||
@@ -87,6 +98,9 @@ class EventController extends Controller
|
||||
* @Route("/esemenyek/{date}/ajax-lista.{_format}", name="KekRozsakFrontBundle_eventAjaxList", requirements={"_format": "html"})
|
||||
* @Template()
|
||||
* @ParamConverter("date", options={"format": "Y-m-d"})
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return array
|
||||
*/
|
||||
public function ajaxListAction(\DateTime $date)
|
||||
{
|
||||
|
@@ -37,6 +37,9 @@ class ForumController extends Controller
|
||||
* @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList")
|
||||
* @Template()
|
||||
* @ParamConverter("topicGroup")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup
|
||||
* @return array
|
||||
*/
|
||||
public function topicListAction(ForumTopicgRoup $topicGroup)
|
||||
{
|
||||
@@ -50,6 +53,10 @@ class ForumController extends Controller
|
||||
* @Template()
|
||||
* @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}})
|
||||
* @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="slug"}})
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup
|
||||
* @param KekRozsak\FrontBundle\Entity\ForumTopic $topic
|
||||
* @return array
|
||||
*/
|
||||
public function postListAction(ForumTopicGroup $topicGroup, ForumTopic $topic)
|
||||
{
|
||||
@@ -88,9 +95,9 @@ class ForumController extends Controller
|
||||
$this->generateUrl(
|
||||
'KekRozsakFrontBundle_forumPostList',
|
||||
array(
|
||||
'topicGroupSlug' => $topicGroup->getSlug(),
|
||||
'topicSlug' => $topic->getSlug(),
|
||||
)
|
||||
'topicGroupSlug' => $topicGroup->getSlug(),
|
||||
'topicSlug' => $topic->getSlug(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ class GroupController extends Controller
|
||||
/**
|
||||
* @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
|
||||
* @Template()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAction()
|
||||
{
|
||||
@@ -36,6 +38,9 @@ class GroupController extends Controller
|
||||
* @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView")
|
||||
* @Template()
|
||||
* @ParamConverter("group")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return array
|
||||
*/
|
||||
public function viewAction(Group $group)
|
||||
{
|
||||
@@ -48,6 +53,9 @@ class GroupController extends Controller
|
||||
* @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers")
|
||||
* @Template()
|
||||
* @ParamConverter("group")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return array
|
||||
*/
|
||||
public function membersAction(Group $group)
|
||||
{
|
||||
@@ -60,6 +68,9 @@ class GroupController extends Controller
|
||||
* @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
|
||||
* @Template()
|
||||
* @ParamConverter("group")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return array
|
||||
*/
|
||||
public function documentsAction(Group $group)
|
||||
{
|
||||
@@ -72,6 +83,9 @@ class GroupController extends Controller
|
||||
* @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin")
|
||||
* @Template()
|
||||
* @ParamConverter("group")
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return array
|
||||
*/
|
||||
public function joinAction(Group $group)
|
||||
{
|
||||
@@ -123,6 +137,8 @@ class GroupController extends Controller
|
||||
/**
|
||||
* @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
|
||||
* @Template()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
|
@@ -5,7 +5,6 @@ namespace KekRozsak\FrontBundle\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
/**
|
||||
* Description of NewsController
|
||||
@@ -17,6 +16,8 @@ class NewsController extends Controller
|
||||
/**
|
||||
* @Route("/newsSideList.html", name="KekRozsakFrontBundle_newsSideList", options={"expose": true})
|
||||
* @Template()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sideListAction()
|
||||
{
|
||||
@@ -26,11 +27,11 @@ class NewsController extends Controller
|
||||
!is_object($this->get('security.context')->getToken())
|
||||
|| !is_object($this->get('security.context')->getToken()->getUser())
|
||||
) {
|
||||
$searchCriteria['public'] = true;
|
||||
$searchCriteria['public'] = true;
|
||||
}
|
||||
|
||||
$news = $newsRepo->findBy($searchCriteria, array('createdAt' => 'DESC'), 4);
|
||||
|
||||
|
||||
return array(
|
||||
'recentNews' => $news,
|
||||
);
|
||||
|
@@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
||||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="articles")
|
||||
*/
|
||||
@@ -46,12 +46,13 @@ class Article
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -77,12 +78,13 @@ class Article
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -108,12 +110,13 @@ class Article
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return Article
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -139,12 +142,13 @@ class Article
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return Article
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -170,12 +174,13 @@ class Article
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text
|
||||
* @return Article
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -201,12 +206,13 @@ class Article
|
||||
/**
|
||||
* Set mainPage
|
||||
*
|
||||
* @param boolean $mainPage
|
||||
* @param boolean $mainPage
|
||||
* @return Article
|
||||
*/
|
||||
public function setMainPage($mainPage)
|
||||
{
|
||||
$this->mainPage = $mainPage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -232,12 +238,13 @@ class Article
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @param boolean $public
|
||||
* @return Article
|
||||
*/
|
||||
public function setPublic($public = false)
|
||||
{
|
||||
$this->public = $public;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -263,12 +270,13 @@ class Article
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source = null)
|
||||
{
|
||||
$this->source = $source;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class Book
|
||||
/**
|
||||
* Remove a copy
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
|
||||
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
|
||||
* @return Book
|
||||
*/
|
||||
public function removeCopy(BookCopy $copy)
|
||||
@@ -83,8 +83,7 @@ class Book
|
||||
*/
|
||||
public function getCopiesBorrowed()
|
||||
{
|
||||
return $this->copies->filter(function($copy)
|
||||
{
|
||||
return $this->copies->filter(function($copy) {
|
||||
return ($copy->getBorrower() !== null);
|
||||
});
|
||||
}
|
||||
@@ -92,13 +91,12 @@ class Book
|
||||
/**
|
||||
* Get the copies of this Book those are borrowed by $user
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return ($copy->getBorrower() == $user);
|
||||
});
|
||||
}
|
||||
@@ -107,13 +105,12 @@ class Book
|
||||
* Get the copies of this Book those are borrowed by $user, but marked as
|
||||
* returned
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowedReturnedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
|
||||
});
|
||||
}
|
||||
@@ -133,13 +130,12 @@ class Book
|
||||
/**
|
||||
* Get $user's copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopies(User $user)
|
||||
{
|
||||
return $this->copies->filter(function ($copy) use ($user)
|
||||
{
|
||||
return $this->copies->filter(function ($copy) use ($user) {
|
||||
return ($copy->getOwner() == $user);
|
||||
});
|
||||
}
|
||||
@@ -147,13 +143,12 @@ class Book
|
||||
/**
|
||||
* Get $user's borrowable copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopiesBorrowable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return (($copy->getOwner() == $user) && $copy->isBorrowable());
|
||||
});
|
||||
}
|
||||
@@ -161,13 +156,12 @@ class Book
|
||||
/**
|
||||
* Get $user's buyable copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopiesBuyable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return (($copy->getOwner() == $user) && $copy->isBuyable());
|
||||
});
|
||||
}
|
||||
@@ -184,13 +178,14 @@ class Book
|
||||
/**
|
||||
* Set author
|
||||
*
|
||||
* @param string $author
|
||||
* @param string $author
|
||||
* @return Book
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->author = $author;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -216,13 +211,14 @@ class Book
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return Book
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -248,13 +244,14 @@ class Book
|
||||
/**
|
||||
* Set year
|
||||
*
|
||||
* @param integer $year
|
||||
* @param integer $year
|
||||
* @return Book
|
||||
*/
|
||||
public function setYear($year)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->year = $year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -289,13 +286,14 @@ class Book
|
||||
/**
|
||||
* Add a user for want-to-borrowers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBorrow(User $user)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->wouldBorrow->add($user);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -312,7 +310,7 @@ class Book
|
||||
/**
|
||||
* Check if $user would like to borrow this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBorrow(User $user)
|
||||
@@ -333,12 +331,13 @@ class Book
|
||||
/**
|
||||
* Add a user for want-to-buyers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBuy(User $user)
|
||||
{
|
||||
$this->wouldBuy->add($user);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -355,7 +354,7 @@ class Book
|
||||
/**
|
||||
* Check if specified user would buy this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBuy(User $user)
|
||||
|
@@ -90,13 +90,14 @@ class BookCopy
|
||||
/**
|
||||
* Set borrowable
|
||||
*
|
||||
* @param boolean $borrowable
|
||||
* @param boolean $borrowable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBorrowable($borrowable)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->borrowable = $borrowable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -122,13 +123,14 @@ class BookCopy
|
||||
/**
|
||||
* Set buyable
|
||||
*
|
||||
* @param boolean $buyable
|
||||
* @param boolean $buyable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBuyable($buyable)
|
||||
{
|
||||
// Check if parameter is boolean!
|
||||
$this->buyable = $buyable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -58,12 +58,13 @@ class Document
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return Document
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -90,12 +91,13 @@ class Document
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return Document
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -122,12 +124,13 @@ class Document
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -153,12 +156,13 @@ class Document
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -184,12 +188,13 @@ class Document
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $content
|
||||
* @param string $content
|
||||
* @return Document
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -212,12 +217,13 @@ class Document
|
||||
/**
|
||||
* Add a group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Document
|
||||
*/
|
||||
public function addGroup(Group $group)
|
||||
{
|
||||
$this->groups[] = $group;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -243,12 +249,13 @@ class Document
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -274,15 +281,16 @@ class Document
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @param DateTime $updatedAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
@@ -298,19 +306,20 @@ class Document
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $updateReason;
|
||||
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param string $updateReason
|
||||
* @param string $updateReason
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
|
@@ -29,7 +29,7 @@ class Event
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@@ -39,7 +39,7 @@ class Event
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The User who created the Event
|
||||
*
|
||||
@@ -49,19 +49,20 @@ class Event
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Event
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
@@ -71,7 +72,7 @@ class Event
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The date on which the Event starts
|
||||
*
|
||||
@@ -80,19 +81,20 @@ class Event
|
||||
* @ORM\Column(type="date", nullable=true, name="start_date", nullable=false)
|
||||
*/
|
||||
protected $startDate;
|
||||
|
||||
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param DateTime $startDate
|
||||
* @param DateTime $startDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartDate(\DateTime $startDate = null)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
@@ -102,7 +104,7 @@ class Event
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The date on which the Event ends. May be null if same as $startDate
|
||||
*
|
||||
@@ -115,13 +117,14 @@ class Event
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param DateTime $endDate
|
||||
* @param DateTime $endDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndDate(\DateTime $endDate = null)
|
||||
{
|
||||
// TODO: Check if endDate is later than startDate
|
||||
$this->endDate = $endDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -148,12 +151,13 @@ class Event
|
||||
/**
|
||||
* Add attendee
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $attendee
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $attendee
|
||||
* @return Event
|
||||
*/
|
||||
public function addAttendee(User $attendee)
|
||||
{
|
||||
$this->attendees[] = $attendee;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -170,13 +174,12 @@ class Event
|
||||
/**
|
||||
* Check if a user is attending
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttending(User $user)
|
||||
{
|
||||
$users = $this->attendees->filter(function ($attendee) use ($user)
|
||||
{
|
||||
$users = $this->attendees->filter(function ($attendee) use ($user) {
|
||||
if ($attendee == $user) {
|
||||
return true;
|
||||
}
|
||||
@@ -199,13 +202,14 @@ class Event
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return Event
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -233,13 +237,14 @@ class Event
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return Event
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -267,13 +272,14 @@ class Event
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @param string $description
|
||||
* @return Event
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -297,12 +303,13 @@ class Event
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Event
|
||||
*/
|
||||
public function setGroup(Group $group = null)
|
||||
{
|
||||
$this->group = $group;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -328,13 +335,14 @@ class Event
|
||||
/**
|
||||
* Set cancelled
|
||||
*
|
||||
* @param boolean $cancelled
|
||||
* @param boolean $cancelled
|
||||
* @return Event
|
||||
*/
|
||||
public function setCancelled($cancelled = false)
|
||||
{
|
||||
// TODO: Check if parameter is boolean
|
||||
$this->cancelled = $cancelled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -360,12 +368,13 @@ class Event
|
||||
/**
|
||||
* Set startTime
|
||||
*
|
||||
* @param DateTime $startTime
|
||||
* @param DateTime $startTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartTime(\DateTime $startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -391,13 +400,14 @@ class Event
|
||||
/**
|
||||
* Set endTime
|
||||
*
|
||||
* @param DateTime $endTime
|
||||
* @param DateTime $endTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndTime(\DateTime $endTime = null)
|
||||
{
|
||||
// TODO: Check if endTime is later than startDate + startTime
|
||||
$this->endTime = $endTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -414,7 +424,7 @@ class Event
|
||||
/**
|
||||
* Check if an event will go on a specific date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOnDate(\DateTime $date)
|
||||
@@ -436,7 +446,7 @@ class Event
|
||||
/**
|
||||
* Check if the event happened before a given date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPast(\DateTime $date = null)
|
||||
|
@@ -40,7 +40,7 @@ class ForumPost
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
@@ -48,20 +48,21 @@ class ForumPost
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
@@ -80,7 +81,7 @@ class ForumPost
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
@@ -111,13 +112,14 @@ class ForumPost
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -143,7 +145,7 @@ class ForumPost
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
@@ -180,6 +182,6 @@ class ForumPost
|
||||
{
|
||||
if ($this->createdAt === null) {
|
||||
$this->createdAt = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,6 +59,7 @@ class ForumTopic
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -84,13 +85,14 @@ class ForumTopic
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -117,13 +119,14 @@ class ForumTopic
|
||||
/**
|
||||
* Set topicGroup
|
||||
*
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTopicGroup(ForumTopicGroup $topicGroup)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->topicGroup = $topicGroup;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -149,13 +152,14 @@ class ForumTopic
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -181,13 +185,14 @@ class ForumTopic
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -214,7 +219,7 @@ class ForumTopic
|
||||
/**
|
||||
* Set lastPost
|
||||
*
|
||||
* @param ForumPost $lastPost
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setLastPost($lastPost = null)
|
||||
@@ -244,13 +249,14 @@ class ForumTopic
|
||||
/**
|
||||
* Add post
|
||||
*
|
||||
* @param ForumPost $post
|
||||
* @param ForumPost $post
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addPost(ForumPost $post)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->posts[] = $post;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -53,13 +53,14 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -85,13 +86,14 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -117,13 +119,14 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -149,12 +152,13 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -180,13 +184,14 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Add topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function addTopic(ForumTopic $topic)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->topics[] = $topic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -55,12 +55,13 @@ class Group
|
||||
/**
|
||||
* Set leader
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @return Group
|
||||
*/
|
||||
public function setLeader(User $leader = null)
|
||||
{
|
||||
$this->leader = $leader;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -88,13 +89,14 @@ class Group
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @return Group
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -120,13 +122,14 @@ class Group
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @param string $slug
|
||||
* @return Group
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -153,12 +156,13 @@ class Group
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -184,13 +188,14 @@ class Group
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -217,13 +222,14 @@ class Group
|
||||
/**
|
||||
* Add member
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
|
||||
* @return Group
|
||||
*/
|
||||
public function addMember(UserGroupMembership $member)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->members[] = $member;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -240,13 +246,12 @@ class Group
|
||||
/**
|
||||
* Check if user is a member of this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isMember(User $user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user) {
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& (
|
||||
@@ -260,13 +265,12 @@ class Group
|
||||
/**
|
||||
* Check if user already requested a membership in this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRequested(User $user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user) {
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& ($groupMembership->getMembershipRequestedAt() !== null)
|
||||
@@ -286,12 +290,13 @@ class Group
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @param string $description
|
||||
* @return Group
|
||||
*/
|
||||
public function setDescription($description = null)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -323,6 +328,7 @@ class Group
|
||||
public function setOpen($open = false)
|
||||
{
|
||||
$this->open = $open;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -353,16 +359,17 @@ class Group
|
||||
/**
|
||||
* Add document
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
* @return Group
|
||||
*/
|
||||
public function addDocument(Document $document)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->documents[] = $document;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all documents
|
||||
*
|
||||
|
@@ -45,13 +45,14 @@ class News
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $title
|
||||
* @return News
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -77,12 +78,13 @@ class News
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text
|
||||
* @return News
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -108,13 +110,14 @@ class News
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @param DateTime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -131,9 +134,9 @@ class News
|
||||
/**
|
||||
* The User who created this News item
|
||||
*
|
||||
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
@@ -141,20 +144,21 @@ class News
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
@@ -173,13 +177,14 @@ class News
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @param boolean $public
|
||||
* @return News
|
||||
*/
|
||||
public function setPublic($public)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->public = $public;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use \KekRozsak\SecurityBundle\Entity\User;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\UserData
|
||||
@@ -38,12 +38,13 @@ class UserData
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserData
|
||||
*/
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -69,13 +70,14 @@ class UserData
|
||||
/**
|
||||
* Set emailPublic
|
||||
*
|
||||
* @param boolean $emailPublic
|
||||
* @param boolean $emailPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setEmailPublic($emailPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->emailPublic = $emailPublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -101,13 +103,14 @@ class UserData
|
||||
/**
|
||||
* Set realName
|
||||
*
|
||||
* @param string $realName
|
||||
* @param string $realName
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealName($realName = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->realName = $realName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -133,13 +136,14 @@ class UserData
|
||||
/**
|
||||
* Set realNamePublic
|
||||
*
|
||||
* @param boolean $realNamePublic
|
||||
* @param boolean $realNamePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealNamePublic($realNamePublic = false)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->realNamePublic = $realNamePublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -165,12 +169,13 @@ class UserData
|
||||
/**
|
||||
* Set selfDescription
|
||||
*
|
||||
* @param string $selfDescription
|
||||
* @param string $selfDescription
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSelfDescription($selfDescription = null)
|
||||
{
|
||||
$this->selfDescription = $selfDescription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -196,13 +201,14 @@ class UserData
|
||||
/**
|
||||
* Set msnAddress
|
||||
*
|
||||
* @param string $msnAddress
|
||||
* @param string $msnAddress
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddress($msnAddress = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->msnAddress = $msnAddress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -228,13 +234,14 @@ class UserData
|
||||
/**
|
||||
* Set msnAddressPublic
|
||||
*
|
||||
* @param boolean $msnAddressPublic
|
||||
* @param boolean $msnAddressPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddressPublic($msnAddressPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->msnAddressPublic = $msnAddressPublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -260,13 +267,14 @@ class UserData
|
||||
/**
|
||||
* Set googleTalk
|
||||
*
|
||||
* @param string $googleTalk
|
||||
* @param string $googleTalk
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalk($googleTalk = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->googleTalk = $googleTalk;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -292,13 +300,14 @@ class UserData
|
||||
/**
|
||||
* Set googleTalkPublic
|
||||
*
|
||||
* @param boolean $googleTalkPublic
|
||||
* @param boolean $googleTalkPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalkPublic($googleTalkPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->googleTalkPublic = $googleTalkPublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -324,13 +333,14 @@ class UserData
|
||||
/**
|
||||
* Set skype
|
||||
*
|
||||
* @param string $skype
|
||||
* @param string $skype
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkype($skype = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->skype = $skype;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -356,13 +366,14 @@ class UserData
|
||||
/**
|
||||
* Set skypePublic
|
||||
*
|
||||
* @param boolean $skypePublic
|
||||
* @param boolean $skypePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkypePublic($skypePublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->skypePublic = $skypePublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -388,13 +399,14 @@ class UserData
|
||||
/**
|
||||
* Set phoneNumber
|
||||
*
|
||||
* @param string $phoneNumber
|
||||
* @param string $phoneNumber
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumber($phoneNumber = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -420,13 +432,14 @@ class UserData
|
||||
/**
|
||||
* Set phoneNumberPublic
|
||||
*
|
||||
* @param boolean $phoneNumberPublic
|
||||
* @param boolean $phoneNumberPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumberPublic($phoneNumberPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->phoneNumberPublic = $phoneNumberPublic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@ use KekRozsak\FrontBundle\Entity\Group;
|
||||
*/
|
||||
class UserGroupMembership
|
||||
{
|
||||
public function __construct(\KekRozsak\SecurityBundle\Entity\User $user, \KekRozsak\FrontBundle\Entity\Group $group)
|
||||
public function __construct(User $user, Group $group)
|
||||
{
|
||||
$this->setUser($user);
|
||||
$this->setGroup($group);
|
||||
@@ -57,13 +57,14 @@ class UserGroupMembership
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ class UserGroupMembership
|
||||
public function setGroup(Group $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -121,13 +123,14 @@ class UserGroupMembership
|
||||
/**
|
||||
* Set membershipRequestedAt
|
||||
*
|
||||
* @param DateTime $membershipRequestedAt
|
||||
* @param DateTime $membershipRequestedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipRequestedAt(\DateTime $membershipRequestedAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->membershipRequestedAt = $membershipRequestedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -153,12 +156,13 @@ class UserGroupMembership
|
||||
/**
|
||||
* Set membershipAcceptedAt
|
||||
*
|
||||
* @param DateTime $membershipAcceptedAt
|
||||
* @param DateTime $membershipAcceptedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
|
||||
{
|
||||
$this->membershipAcceptedAt = $membershipAcceptedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -188,9 +192,10 @@ class UserGroupMembership
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null)
|
||||
public function setMembershipAcceptedBy(User $membershipAcceptedBy = null)
|
||||
{
|
||||
$this->membershipAcceptedBy = $membershipAcceptedBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@ class Slugifier
|
||||
/**
|
||||
* Slugify string
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public function slugify($text)
|
||||
|
@@ -13,13 +13,13 @@ class GroupType extends AbstractType
|
||||
'label' => 'A csoport neve',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$builder->add('description', 'ckeditor', array(
|
||||
'label' => 'A csoport leírása',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'group';
|
||||
|
@@ -138,4 +138,3 @@
|
||||
{% block bottomscripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@@ -7,4 +7,4 @@
|
||||
{% endif %}
|
||||
<p class="hir-datum">{{ news.createdAt|date('Y-m-d H:i') }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
@@ -21,7 +21,7 @@ class EventsExtension extends \Twig_Extension
|
||||
* "securityContext" = @DI\Inject("security.context")
|
||||
* })
|
||||
*
|
||||
* @param \Symfony\Bridge\Doctrine\RegistryInterface $doctrine
|
||||
* @param \Symfony\Bridge\Doctrine\RegistryInterface $doctrine
|
||||
* @param \Symfony\Component\Security\Core\SecurityContextInterface $securityContext
|
||||
*/
|
||||
public function __construct(RegistryInterface $doctrine, SecurityContextInterface $securityContext)
|
||||
@@ -56,7 +56,7 @@ class EventsExtension extends \Twig_Extension
|
||||
);
|
||||
$eventList[$i]['date'] = $date;
|
||||
$eventList[$i]['events'] = array();
|
||||
foreach ($events as $event) {
|
||||
foreach ($events as $event) {
|
||||
if ($event->isOnDate($date)) {
|
||||
$eventList[$i]['events'][] = $event;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
/**
|
||||
* @DI\Service
|
||||
* @DI\Tag("twig.extension")
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TwigBBExtension extends \Twig_Extension
|
||||
{
|
||||
|
@@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
||||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,6 @@ namespace KekRozsak\SecurityBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\Role\RoleInterface;
|
||||
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\SecurityBundle\Entity\Role
|
||||
*
|
||||
@@ -48,13 +46,14 @@ class Role implements RoleInterface
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @return Role
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
// TODO: Check if null or empty!
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -86,6 +85,7 @@ class Role implements RoleInterface
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->default = $default;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -101,12 +101,13 @@ class Role implements RoleInterface
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @param string $description
|
||||
* @return Role
|
||||
*/
|
||||
public function setDescription($description = null)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -139,13 +140,14 @@ class Role implements RoleInterface
|
||||
/**
|
||||
* Set shortDescription
|
||||
*
|
||||
* @param string $shortDescription
|
||||
* @param string $shortDescription
|
||||
* @return Role
|
||||
*/
|
||||
public function setShortDescription($shortDescription)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->shortDescription = $shortDescription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -63,13 +63,14 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
// TODO: check if null or empty!
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -96,12 +97,13 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -127,13 +129,14 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set displayName
|
||||
*
|
||||
* @param string $displayName
|
||||
* @param string $displayName
|
||||
* @return User
|
||||
*/
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->displayName = $displayName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -159,13 +162,14 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set email
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $email
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -191,12 +195,13 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set registeredAt
|
||||
*
|
||||
* @param DateTime $registeredAt
|
||||
* @param DateTime $registeredAt
|
||||
* @return User
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -223,12 +228,13 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set acceptedBy
|
||||
*
|
||||
* @param User $acceptedBy
|
||||
* @param User $acceptedBy
|
||||
* @return User
|
||||
*/
|
||||
public function setAcceptedBy(User $acceptedBy = null)
|
||||
{
|
||||
$this->acceptedBy = $acceptedBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -254,12 +260,13 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set lastLoginAt;
|
||||
*
|
||||
* @param DateTime $lastLoginAt
|
||||
* @param DateTime $lastLoginAt
|
||||
* @return User
|
||||
*/
|
||||
public function setLastLoginAt(\DateTime $lastLoginAt = null)
|
||||
{
|
||||
$this->lastLoginAt = $lastLoginAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -276,7 +283,7 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* The UserData object for this User
|
||||
*
|
||||
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @var KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
|
||||
*/
|
||||
@@ -285,20 +292,21 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Set userData
|
||||
*
|
||||
* @param \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @param KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @return User
|
||||
*/
|
||||
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
|
||||
public function setUserData(UserData $userData = null)
|
||||
{
|
||||
$this->userData = $userData;
|
||||
$userData->setUser($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userData
|
||||
*
|
||||
* @return \KekRozsak\FrontBundle\Entity\UserData
|
||||
* @return KekRozsak\FrontBundle\Entity\UserData
|
||||
*/
|
||||
public function getUserData()
|
||||
{
|
||||
@@ -319,13 +327,14 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Add group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $group
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $group
|
||||
* @return User
|
||||
*/
|
||||
public function addGroup(UserGroupMembership $group)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->groups[] = $group;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -351,13 +360,14 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
/**
|
||||
* Add a role
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\Role $role
|
||||
* @param KekRozsak\SecurityBundle\Entity\Role $role
|
||||
* @return User
|
||||
*/
|
||||
public function addRole(Role $role)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->roles[] = $role;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -390,6 +400,7 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
* As we use crypt() to encode passwords, salt is always the same as the
|
||||
* password
|
||||
*/
|
||||
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
@@ -402,24 +413,28 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
public function isAccountNonExpired()
|
||||
{
|
||||
/* Currently, accounts never expire */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
/* Currently, accounts cannot be locked */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
/* Currently, credentials never expire */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
/* Account is enabled if it is accepted by someone */
|
||||
|
||||
return ($this->acceptedBy !== null);
|
||||
}
|
||||
}
|
||||
|
@@ -9,12 +9,12 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
*/
|
||||
class CryptEncoder implements PasswordEncoderInterface
|
||||
{
|
||||
function encodePassword($raw, $salt)
|
||||
public function encodePassword($raw, $salt)
|
||||
{
|
||||
return crypt($raw);
|
||||
}
|
||||
|
||||
function isPasswordValid($encoded, $raw, $salt)
|
||||
public function isPasswordValid($encoded, $raw, $salt)
|
||||
{
|
||||
return (crypt($raw, $salt) == $encoded);
|
||||
}
|
||||
|
@@ -10,15 +10,15 @@ class RoleHierarchy implements RoleHierarchyInterface
|
||||
private $hierarchy;
|
||||
private $roleRepo;
|
||||
private $map;
|
||||
|
||||
|
||||
public function __construct(RegistryInterface $doctrine)
|
||||
{
|
||||
$this->hierarchy = array();
|
||||
$this->roleRepo = $doctrine->getRepository('KekRozsakSecurityBundle:Role');
|
||||
|
||||
|
||||
$this->buildRoleMap();
|
||||
}
|
||||
|
||||
|
||||
public function getReachableRoles(array $roles)
|
||||
{
|
||||
$reachableRoles = array();
|
||||
@@ -26,17 +26,17 @@ class RoleHierarchy implements RoleHierarchyInterface
|
||||
if (!isset($this->map[$role->getRole()])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->map[$role->getRole()] as $r) {
|
||||
if (($childRole = $this->roleRepo->findOneByName($r)) !== null) {
|
||||
$reachableRoles[] = $childRole;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $reachableRoles;
|
||||
}
|
||||
|
||||
|
||||
private function buildRoleMap()
|
||||
{
|
||||
$this->map = array();
|
||||
|
@@ -23,7 +23,7 @@ class UserDataSpanExtension extends \Twig_Extension
|
||||
* "security" = @DI\Inject("security.context")
|
||||
* })
|
||||
*
|
||||
* @param \Symfony\Bundle\FrameworkBundle\Routing\Router $router
|
||||
* @param \Symfony\Bundle\FrameworkBundle\Routing\Router $router
|
||||
* @param \Symfony\Component\Security\Core\SecurityContextInterface $security
|
||||
*/
|
||||
public function __construct(Router $router, SecurityContextInterface $security)
|
||||
|
Reference in New Issue
Block a user