Applied php-cs-fixer and added some @PHPDoc

Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely POLONKAI 2012-08-17 16:18:43 +02:00
parent 4772fd2273
commit aed588e5e2
42 changed files with 479 additions and 349 deletions

View File

@ -5,14 +5,10 @@ namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration, use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema; Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120731113533 extends AbstractMigration class Version20120731113533 extends AbstractMigration
{ {
public function up(Schema $schema) public function up(Schema $schema)
{ {
// this up() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, accepted_by_id INT DEFAULT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, display_name VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, registered_at DATETIME NOT NULL, last_login_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_1483A5E9F85E0677 (username), UNIQUE INDEX UNIQ_1483A5E9D5499347 (display_name), UNIQUE INDEX UNIQ_1483A5E9E7927C74 (email), INDEX IDX_1483A5E920F699D9 (accepted_by_id), PRIMARY KEY(id)) ENGINE = InnoDB"); $this->addSql("CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, accepted_by_id INT DEFAULT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, display_name VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, registered_at DATETIME NOT NULL, last_login_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_1483A5E9F85E0677 (username), UNIQUE INDEX UNIQ_1483A5E9D5499347 (display_name), UNIQUE INDEX UNIQ_1483A5E9E7927C74 (email), INDEX IDX_1483A5E920F699D9 (accepted_by_id), PRIMARY KEY(id)) ENGINE = InnoDB");
@ -73,7 +69,6 @@ class Version20120731113533 extends AbstractMigration
public function down(Schema $schema) public function down(Schema $schema)
{ {
// this down() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE event_attendees DROP FOREIGN KEY FK_4E5C551871F7E88B"); $this->addSql("ALTER TABLE event_attendees DROP FOREIGN KEY FK_4E5C551871F7E88B");

View File

@ -12,4 +12,3 @@ KekRozsakFrontBundle:
KekRozsakSecurityBundle: KekRozsakSecurityBundle:
resource: "@KekRozsakSecurityBundle/Controller/" resource: "@KekRozsakSecurityBundle/Controller/"
type: annotation type: annotation

View File

@ -69,7 +69,6 @@ class DefaultController extends Controller
public function groupJoinDeclineAction() public function groupJoinDeclineAction()
{ {
// TODO: A reason must be written to decline a join request! // TODO: A reason must be written to decline a join request!
return array( return array(
); );
} }

View File

@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
// Here you should define the parameters that are allowed to // Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for // configure your bundle. See the documentation linked above for
// more information on that topic. // more information on that topic.
return $treeBuilder; return $treeBuilder;
} }
} }

View File

@ -32,6 +32,8 @@ class BookController extends Controller
* @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true}) * @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true})
* @Template() * @Template()
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
*/ */
public function ajaxDataAction(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}) * @Route("/konyv/torles/{id}", name="KekRozsakFrontBundle_bookDeleteCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
*/ */
public function ajaxDeleteBookAction(Book $book) public function ajaxDeleteBookAction(Book $book)
{ {
$copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser()); $copies = $book->getUsersCopies($this->get('security.context')->getToken()->getUser());
$em = $this->getDoctrine()->getEntityManager(); $em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($book, $em) $copies->forAll(function($key, $copy) use ($book, $em) {
{
$book->removeCopy($copy); $book->removeCopy($copy);
$em->remove($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}) * @Route("/konyv/ujpeldany/{id}", name="KekRozsakFrontBundle_bookAddCopy", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
*/ */
public function ajaxAddCopyAction(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}) * @Route("/konyv/kolcsonozheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyBorrowable", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
* @param boolean $newValue
*/ */
public function ajaxSetBookCopyBorrowableAction(Book $book, $newValue) public function ajaxSetBookCopyBorrowableAction(Book $book, $newValue)
{ {
$user = $this->get('security.context')->getToken()->getUser(); $user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user); $copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager(); $em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) $copies->forAll(function($key, $copy) use ($em, $newValue) {
{
$copy->setBorrowable($newValue); $copy->setBorrowable($newValue);
$em->persist($copy); $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}) * @Route("/konyv/megveheto/{id}/{newValue}", name="KekRozsakFrontBundle_bookSetCopyForSale", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
* @param boolean $newValue
*/ */
public function ajaxSetBookCopyForSaleAction(Book $book, $newValue) public function ajaxSetBookCopyForSaleAction(Book $book, $newValue)
{ {
$user = $this->get('security.context')->getToken()->getUser(); $user = $this->get('security.context')->getToken()->getUser();
$copies = $book->getUsersCopies($user); $copies = $book->getUsersCopies($user);
$em = $this->getDoctrine()->getEntityManager(); $em = $this->getDoctrine()->getEntityManager();
$copies->forAll(function($key, $copy) use ($em, $newValue) $copies->forAll(function($key, $copy) use ($em, $newValue) {
{
$copy->setBuyable($newValue); $copy->setBuyable($newValue);
$em->persist($copy); $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}) * @Route("/konyv/szeretnek/{id}/{wantToBuy}", name="KekRozsakFrontBundle_bookWantOne", requirements={"id": "\d+"}, options={"expose": true})
* @ParamConverter("book") * @ParamConverter("book")
*
* @param KekRozsak\FrontBundle\Entity\Book $book
* @param boolean $wantToBuy
*/ */
public function ajaxWantABookAction(Book $book, $wantToBuy) public function ajaxWantABookAction(Book $book, $wantToBuy)
{ {

View File

@ -5,10 +5,7 @@ namespace KekRozsak\FrontBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; 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\FrontBundle\Entity\Article;
use KekRozsak\SecurityBundle\Form\Type\UserType; use KekRozsak\SecurityBundle\Form\Type\UserType;

View File

@ -17,6 +17,9 @@ class DocumentController extends Controller
* @Route("/dokumentum/{slug}.{_format}", name="KekRozsakFrontBundle_documentView", defaults={"_format": "html"}, requirements={"_format": "html|pdf"}) * @Route("/dokumentum/{slug}.{_format}", name="KekRozsakFrontBundle_documentView", defaults={"_format": "html"}, requirements={"_format": "html|pdf"})
* @Template() * @Template()
* @ParamConverter("document") * @ParamConverter("document")
*
* @param KekRozsak\FrontBundle\Entity\Document $document
* @param string $_format
*/ */
public function viewAction(Document $document, $_format) public function viewAction(Document $document, $_format)
{ {
@ -29,6 +32,7 @@ class DocumentController extends Controller
'KekRozsakFrontBundle:Document:pdfView.html.twig', 'KekRozsakFrontBundle:Document:pdfView.html.twig',
$templateParams $templateParams
); );
return $this->get('io_tcpdf')->quick_pdf($html); return $this->get('io_tcpdf')->quick_pdf($html);
} }
@ -78,6 +82,8 @@ class DocumentController extends Controller
* @Route("/dokumentum/{slug}/szerkesztes", name="KekRozsakFrontBundle_documentEdit") * @Route("/dokumentum/{slug}/szerkesztes", name="KekRozsakFrontBundle_documentEdit")
* @Template() * @Template()
* @ParamConverter("document") * @ParamConverter("document")
*
* @param KekRozsak\FrontBundle\Entity\Document $document
*/ */
public function editAction(Document $document) public function editAction(Document $document)
{ {

View File

@ -17,6 +17,10 @@ class EventController extends Controller
* @Template() * @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug" = "slug", "startDate"="startDate"}}) * @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug" = "slug", "startDate"="startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"}) * @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) public function viewAction(\DateTime $startDate, Event $event)
{ {
@ -36,6 +40,10 @@ class EventController extends Controller
* @Template() * @Template()
* @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug": "slug", "startDate": "startDate"}}) * @ParamConverter("event", class="KekRozsakFrontBundle:Event", options={"mapping"={"eventSlug": "slug", "startDate": "startDate"}})
* @ParamConverter("startDate", class="DateTime", options={"format"="Y-m-d"}) * @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) public function joinAction(\DateTime $startDate, Event $event)
{ {
@ -62,6 +70,9 @@ class EventController extends Controller
/** /**
* @Route("/esemenyek/{date}", name="KekRozsakFrontBundle_eventList", defaults={"date": null}) * @Route("/esemenyek/{date}", name="KekRozsakFrontBundle_eventList", defaults={"date": null})
* @Template() * @Template()
*
* @param string $date
* @return array
*/ */
public function listAction($date = null) 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"}) * @Route("/esemenyek/{date}/ajax-lista.{_format}", name="KekRozsakFrontBundle_eventAjaxList", requirements={"_format": "html"})
* @Template() * @Template()
* @ParamConverter("date", options={"format": "Y-m-d"}) * @ParamConverter("date", options={"format": "Y-m-d"})
*
* @param DateTime $date
* @return array
*/ */
public function ajaxListAction(\DateTime $date) public function ajaxListAction(\DateTime $date)
{ {

View File

@ -37,6 +37,9 @@ class ForumController extends Controller
* @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList") * @Route("/{slug}", name="KekRozsakFrontBundle_forumTopicList")
* @Template() * @Template()
* @ParamConverter("topicGroup") * @ParamConverter("topicGroup")
*
* @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup
* @return array
*/ */
public function topicListAction(ForumTopicgRoup $topicGroup) public function topicListAction(ForumTopicgRoup $topicGroup)
{ {
@ -50,6 +53,10 @@ class ForumController extends Controller
* @Template() * @Template()
* @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}}) * @ParamConverter("topic", options={"mapping"={"topicGroup"="topicGroup", "topicSlug"="slug"}})
* @ParamConverter("topicGroup", options={"mapping"={"topicGroupSlug"="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) public function postListAction(ForumTopicGroup $topicGroup, ForumTopic $topic)
{ {

View File

@ -19,6 +19,8 @@ class GroupController extends Controller
/** /**
* @Route("/csoportok", name="KekRozsakFrontBundle_groupList") * @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
* @Template() * @Template()
*
* @return array
*/ */
public function listAction() public function listAction()
{ {
@ -36,6 +38,9 @@ class GroupController extends Controller
* @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView") * @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView")
* @Template() * @Template()
* @ParamConverter("group") * @ParamConverter("group")
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return array
*/ */
public function viewAction(Group $group) public function viewAction(Group $group)
{ {
@ -48,6 +53,9 @@ class GroupController extends Controller
* @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers") * @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers")
* @Template() * @Template()
* @ParamConverter("group") * @ParamConverter("group")
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return array
*/ */
public function membersAction(Group $group) public function membersAction(Group $group)
{ {
@ -60,6 +68,9 @@ class GroupController extends Controller
* @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments") * @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
* @Template() * @Template()
* @ParamConverter("group") * @ParamConverter("group")
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return array
*/ */
public function documentsAction(Group $group) public function documentsAction(Group $group)
{ {
@ -72,6 +83,9 @@ class GroupController extends Controller
* @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin") * @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin")
* @Template() * @Template()
* @ParamConverter("group") * @ParamConverter("group")
*
* @param KekRozsak\FrontBundle\Entity\Group $group
* @return array
*/ */
public function joinAction(Group $group) public function joinAction(Group $group)
{ {
@ -123,6 +137,8 @@ class GroupController extends Controller
/** /**
* @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate") * @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
* @Template() * @Template()
*
* @return array
*/ */
public function createAction() public function createAction()
{ {

View File

@ -5,7 +5,6 @@ namespace KekRozsak\FrontBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
/** /**
* Description of NewsController * Description of NewsController
@ -17,6 +16,8 @@ class NewsController extends Controller
/** /**
* @Route("/newsSideList.html", name="KekRozsakFrontBundle_newsSideList", options={"expose": true}) * @Route("/newsSideList.html", name="KekRozsakFrontBundle_newsSideList", options={"expose": true})
* @Template() * @Template()
*
* @return array
*/ */
public function sideListAction() public function sideListAction()
{ {

View File

@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
// Here you should define the parameters that are allowed to // Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for // configure your bundle. See the documentation linked above for
// more information on that topic. // more information on that topic.
return $treeBuilder; return $treeBuilder;
} }
} }

View File

@ -49,9 +49,10 @@ class Article
* @param KekRozsak\SecurityBundle\Entity\User $createdBy * @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return Article * @return Article
*/ */
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy) public function setCreatedBy(User $createdBy)
{ {
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -83,6 +84,7 @@ class Article
public function setCreatedAt(\DateTime $createdAt) public function setCreatedAt(\DateTime $createdAt)
{ {
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -114,6 +116,7 @@ class Article
public function setTitle($title) public function setTitle($title)
{ {
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -145,6 +148,7 @@ class Article
public function setSlug($slug) public function setSlug($slug)
{ {
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -176,6 +180,7 @@ class Article
public function setText($text) public function setText($text)
{ {
$this->text = $text; $this->text = $text;
return $this; return $this;
} }
@ -207,6 +212,7 @@ class Article
public function setMainPage($mainPage) public function setMainPage($mainPage)
{ {
$this->mainPage = $mainPage; $this->mainPage = $mainPage;
return $this; return $this;
} }
@ -238,6 +244,7 @@ class Article
public function setPublic($public = false) public function setPublic($public = false)
{ {
$this->public = $public; $this->public = $public;
return $this; return $this;
} }
@ -269,6 +276,7 @@ class Article
public function setSource($source = null) public function setSource($source = null)
{ {
$this->source = $source; $this->source = $source;
return $this; return $this;
} }

View File

@ -83,8 +83,7 @@ class Book
*/ */
public function getCopiesBorrowed() public function getCopiesBorrowed()
{ {
return $this->copies->filter(function($copy) return $this->copies->filter(function($copy) {
{
return ($copy->getBorrower() !== null); return ($copy->getBorrower() !== null);
}); });
} }
@ -92,13 +91,12 @@ class Book
/** /**
* Get the copies of this Book those are borrowed by $user * 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 * @return Doctrine\Common\Collections\ArrayCollection
*/ */
public function getCopiesBorrowedByUser(User $user) 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); return ($copy->getBorrower() == $user);
}); });
} }
@ -107,13 +105,12 @@ class Book
* Get the copies of this Book those are borrowed by $user, but marked as * Get the copies of this Book those are borrowed by $user, but marked as
* returned * returned
* *
* @param \KekRozsak\SecurityBundle\Entity\User $user * @param KekRozsak\SecurityBundle\Entity\User $user
* @return Doctrine\Common\Collections\ArrayCollection * @return Doctrine\Common\Collections\ArrayCollection
*/ */
public function getCopiesBorrowedReturnedByUser(User $user) 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()); return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
}); });
} }
@ -133,13 +130,12 @@ class Book
/** /**
* Get $user's copies of this 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 * @return Doctrine\Common\Collections\ArrayCollection
*/ */
public function getUsersCopies(User $user) 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); return ($copy->getOwner() == $user);
}); });
} }
@ -147,13 +143,12 @@ class Book
/** /**
* Get $user's borrowable copies of this 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 * @return Doctrine\Common\Collections\ArrayCollection
*/ */
public function getUsersCopiesBorrowable(User $user) 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()); return (($copy->getOwner() == $user) && $copy->isBorrowable());
}); });
} }
@ -161,13 +156,12 @@ class Book
/** /**
* Get $user's buyable copies of this 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 * @return Doctrine\Common\Collections\ArrayCollection
*/ */
public function getUsersCopiesBuyable(User $user) 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()); return (($copy->getOwner() == $user) && $copy->isBuyable());
}); });
} }
@ -191,6 +185,7 @@ class Book
{ {
// TODO: Check if null! // TODO: Check if null!
$this->author = $author; $this->author = $author;
return $this; return $this;
} }
@ -223,6 +218,7 @@ class Book
{ {
// TODO: Check if null! // TODO: Check if null!
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -255,6 +251,7 @@ class Book
{ {
// TODO: Check if null! // TODO: Check if null!
$this->year = $year; $this->year = $year;
return $this; return $this;
} }
@ -296,6 +293,7 @@ class Book
{ {
// TODO: Check if null! // TODO: Check if null!
$this->wouldBorrow->add($user); $this->wouldBorrow->add($user);
return $this; return $this;
} }
@ -339,6 +337,7 @@ class Book
public function addWouldBuy(User $user) public function addWouldBuy(User $user)
{ {
$this->wouldBuy->add($user); $this->wouldBuy->add($user);
return $this; return $this;
} }

View File

@ -97,6 +97,7 @@ class BookCopy
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->borrowable = $borrowable; $this->borrowable = $borrowable;
return $this; return $this;
} }
@ -129,6 +130,7 @@ class BookCopy
{ {
// Check if parameter is boolean! // Check if parameter is boolean!
$this->buyable = $buyable; $this->buyable = $buyable;
return $this; return $this;
} }

View File

@ -64,6 +64,7 @@ class Document
public function setTitle($title) public function setTitle($title)
{ {
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -96,6 +97,7 @@ class Document
public function setSlug($slug) public function setSlug($slug)
{ {
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -128,6 +130,7 @@ class Document
public function setCreatedBy(User $createdBy) public function setCreatedBy(User $createdBy)
{ {
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -159,6 +162,7 @@ class Document
public function setCreatedAt(\DateTime $createdAt) public function setCreatedAt(\DateTime $createdAt)
{ {
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -190,6 +194,7 @@ class Document
public function setContent($content) public function setContent($content)
{ {
$this->content = $content; $this->content = $content;
return $this; return $this;
} }
@ -218,6 +223,7 @@ class Document
public function addGroup(Group $group) public function addGroup(Group $group)
{ {
$this->groups[] = $group; $this->groups[] = $group;
return $this; return $this;
} }
@ -249,6 +255,7 @@ class Document
public function setUpdatedBy(User $updatedBy = null) public function setUpdatedBy(User $updatedBy = null)
{ {
$this->updatedBy = $updatedBy; $this->updatedBy = $updatedBy;
return $this; return $this;
} }
@ -280,6 +287,7 @@ class Document
public function setUpdatedAt(\DateTime $updatedAt = null) public function setUpdatedAt(\DateTime $updatedAt = null)
{ {
$this->updatedAt = $updatedAt; $this->updatedAt = $updatedAt;
return $this; return $this;
} }
@ -308,6 +316,7 @@ class Document
public function setUpdateReason($updateReason = null) public function setUpdateReason($updateReason = null)
{ {
$this->updateReason = $updateReason; $this->updateReason = $updateReason;
return $this; return $this;
} }

View File

@ -59,6 +59,7 @@ class Event
public function setCreatedBy(User $createdBy) public function setCreatedBy(User $createdBy)
{ {
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -90,6 +91,7 @@ class Event
public function setStartDate(\DateTime $startDate = null) public function setStartDate(\DateTime $startDate = null)
{ {
$this->startDate = $startDate; $this->startDate = $startDate;
return $this; return $this;
} }
@ -122,6 +124,7 @@ class Event
{ {
// TODO: Check if endDate is later than startDate // TODO: Check if endDate is later than startDate
$this->endDate = $endDate; $this->endDate = $endDate;
return $this; return $this;
} }
@ -154,6 +157,7 @@ class Event
public function addAttendee(User $attendee) public function addAttendee(User $attendee)
{ {
$this->attendees[] = $attendee; $this->attendees[] = $attendee;
return $this; return $this;
} }
@ -175,8 +179,7 @@ class Event
*/ */
public function isAttending(User $user) public function isAttending(User $user)
{ {
$users = $this->attendees->filter(function ($attendee) use ($user) $users = $this->attendees->filter(function ($attendee) use ($user) {
{
if ($attendee == $user) { if ($attendee == $user) {
return true; return true;
} }
@ -206,6 +209,7 @@ class Event
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -240,6 +244,7 @@ class Event
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -274,6 +279,7 @@ class Event
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->description = $description; $this->description = $description;
return $this; return $this;
} }
@ -303,6 +309,7 @@ class Event
public function setGroup(Group $group = null) public function setGroup(Group $group = null)
{ {
$this->group = $group; $this->group = $group;
return $this; return $this;
} }
@ -335,6 +342,7 @@ class Event
{ {
// TODO: Check if parameter is boolean // TODO: Check if parameter is boolean
$this->cancelled = $cancelled; $this->cancelled = $cancelled;
return $this; return $this;
} }
@ -366,6 +374,7 @@ class Event
public function setStartTime(\DateTime $startTime) public function setStartTime(\DateTime $startTime)
{ {
$this->startTime = $startTime; $this->startTime = $startTime;
return $this; return $this;
} }
@ -398,6 +407,7 @@ class Event
{ {
// TODO: Check if endTime is later than startDate + startTime // TODO: Check if endTime is later than startDate + startTime
$this->endTime = $endTime; $this->endTime = $endTime;
return $this; return $this;
} }

View File

@ -40,7 +40,7 @@ class ForumPost
* *
* @var KekRozsak\SecurityBundle\Entity\User $createBy * @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") * @ORM\JoinColumn(name="created_by_id")
*/ */
protected $createdBy; protected $createdBy;
@ -48,20 +48,21 @@ class ForumPost
/** /**
* Set createdBy * Set createdBy
* *
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy * @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return ForumPost * @return ForumPost
*/ */
public function setCreatedBy(User $createdBy) public function setCreatedBy(User $createdBy)
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get createdBy * Get createdBy
* *
* @return \KekRozsak\SecurityBundle\Entity\User * @return KekRozsak\SecurityBundle\Entity\User
*/ */
public function getCreatedBy() public function getCreatedBy()
{ {
@ -118,6 +119,7 @@ class ForumPost
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->text = $text; $this->text = $text;
return $this; return $this;
} }

View File

@ -59,6 +59,7 @@ class ForumTopic
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -91,6 +92,7 @@ class ForumTopic
{ {
// TODO: Check if not null! // TODO: Check if not null!
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -124,6 +126,7 @@ class ForumTopic
{ {
// TODO: Check if not null! // TODO: Check if not null!
$this->topicGroup = $topicGroup; $this->topicGroup = $topicGroup;
return $this; return $this;
} }
@ -156,6 +159,7 @@ class ForumTopic
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -188,6 +192,7 @@ class ForumTopic
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -251,6 +256,7 @@ class ForumTopic
{ {
// TODO: Check if null! // TODO: Check if null!
$this->posts[] = $post; $this->posts[] = $post;
return $this; return $this;
} }

View File

@ -60,6 +60,7 @@ class ForumTopicGroup
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -92,6 +93,7 @@ class ForumTopicGroup
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -124,6 +126,7 @@ class ForumTopicGroup
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -155,6 +158,7 @@ class ForumTopicGroup
public function setTitle($title) public function setTitle($title)
{ {
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -187,6 +191,7 @@ class ForumTopicGroup
{ {
// TODO: Check if null! // TODO: Check if null!
$this->topics[] = $topic; $this->topics[] = $topic;
return $this; return $this;
} }

View File

@ -61,6 +61,7 @@ class Group
public function setLeader(User $leader = null) public function setLeader(User $leader = null)
{ {
$this->leader = $leader; $this->leader = $leader;
return $this; return $this;
} }
@ -95,6 +96,7 @@ class Group
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@ -127,6 +129,7 @@ class Group
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->slug = $slug; $this->slug = $slug;
return $this; return $this;
} }
@ -159,6 +162,7 @@ class Group
public function setCreatedBy(User $createdBy) public function setCreatedBy(User $createdBy)
{ {
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
@ -191,6 +195,7 @@ class Group
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -224,6 +229,7 @@ class Group
{ {
// TODO: Check if null! // TODO: Check if null!
$this->members[] = $member; $this->members[] = $member;
return $this; return $this;
} }
@ -245,8 +251,7 @@ class Group
*/ */
public function isMember(User $user) public function isMember(User $user)
{ {
return ($this->members->filter(function ($groupMembership) use ($user) return ($this->members->filter(function ($groupMembership) use ($user) {
{
return ( return (
($groupMembership->getUser() == $user) ($groupMembership->getUser() == $user)
&& ( && (
@ -265,8 +270,7 @@ class Group
*/ */
public function isRequested(User $user) public function isRequested(User $user)
{ {
return ($this->members->filter(function ($groupMembership) use ($user) return ($this->members->filter(function ($groupMembership) use ($user) {
{
return ( return (
($groupMembership->getUser() == $user) ($groupMembership->getUser() == $user)
&& ($groupMembership->getMembershipRequestedAt() !== null) && ($groupMembership->getMembershipRequestedAt() !== null)
@ -292,6 +296,7 @@ class Group
public function setDescription($description = null) public function setDescription($description = null)
{ {
$this->description = $description; $this->description = $description;
return $this; return $this;
} }
@ -323,6 +328,7 @@ class Group
public function setOpen($open = false) public function setOpen($open = false)
{ {
$this->open = $open; $this->open = $open;
return $this; return $this;
} }
@ -360,6 +366,7 @@ class Group
{ {
// TODO: Check if null! // TODO: Check if null!
$this->documents[] = $document; $this->documents[] = $document;
return $this; return $this;
} }

View File

@ -52,6 +52,7 @@ class News
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->title = $title; $this->title = $title;
return $this; return $this;
} }
@ -83,6 +84,7 @@ class News
public function setText($text) public function setText($text)
{ {
$this->text = $text; $this->text = $text;
return $this; return $this;
} }
@ -115,6 +117,7 @@ class News
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdAt = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
@ -131,9 +134,9 @@ class News
/** /**
* The User who created this News item * 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") * @ORM\JoinColumn(name="created_by_id")
*/ */
protected $createdBy; protected $createdBy;
@ -141,20 +144,21 @@ class News
/** /**
* Set createdBy * Set createdBy
* *
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy * @param KekRozsak\SecurityBundle\Entity\User $createdBy
* @return News * @return News
*/ */
public function setCreatedBy(User $createdBy) public function setCreatedBy(User $createdBy)
{ {
// TODO: Check if null! // TODO: Check if null!
$this->createdBy = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get createdBy * Get createdBy
* *
* @return \KekRozsak\SecurityBundle\Entity\User * @return KekRozsak\SecurityBundle\Entity\User
*/ */
public function getCreatedBy() public function getCreatedBy()
{ {
@ -180,6 +184,7 @@ class News
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->public = $public; $this->public = $public;
return $this; return $this;
} }

View File

@ -4,7 +4,7 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use \KekRozsak\SecurityBundle\Entity\User; use KekRozsak\SecurityBundle\Entity\User;
/** /**
* KekRozsak\FrontBundle\Entity\UserData * KekRozsak\FrontBundle\Entity\UserData
@ -41,9 +41,10 @@ class UserData
* @param KekRozsak\SecurityBundle\Entity\User $user * @param KekRozsak\SecurityBundle\Entity\User $user
* @return UserData * @return UserData
*/ */
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user) public function setUser(User $user)
{ {
$this->user = $user; $this->user = $user;
return $this; return $this;
} }
@ -76,6 +77,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->emailPublic = $emailPublic; $this->emailPublic = $emailPublic;
return $this; return $this;
} }
@ -108,6 +110,7 @@ class UserData
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->realName = $realName; $this->realName = $realName;
return $this; return $this;
} }
@ -140,6 +143,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->realNamePublic = $realNamePublic; $this->realNamePublic = $realNamePublic;
return $this; return $this;
} }
@ -171,6 +175,7 @@ class UserData
public function setSelfDescription($selfDescription = null) public function setSelfDescription($selfDescription = null)
{ {
$this->selfDescription = $selfDescription; $this->selfDescription = $selfDescription;
return $this; return $this;
} }
@ -203,6 +208,7 @@ class UserData
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->msnAddress = $msnAddress; $this->msnAddress = $msnAddress;
return $this; return $this;
} }
@ -235,6 +241,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->msnAddressPublic = $msnAddressPublic; $this->msnAddressPublic = $msnAddressPublic;
return $this; return $this;
} }
@ -267,6 +274,7 @@ class UserData
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->googleTalk = $googleTalk; $this->googleTalk = $googleTalk;
return $this; return $this;
} }
@ -299,6 +307,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->googleTalkPublic = $googleTalkPublic; $this->googleTalkPublic = $googleTalkPublic;
return $this; return $this;
} }
@ -331,6 +340,7 @@ class UserData
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->skype = $skype; $this->skype = $skype;
return $this; return $this;
} }
@ -363,6 +373,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->skypePublic = $skypePublic; $this->skypePublic = $skypePublic;
return $this; return $this;
} }
@ -395,6 +406,7 @@ class UserData
{ {
// TODO: Check if empty! // TODO: Check if empty!
$this->phoneNumber = $phoneNumber; $this->phoneNumber = $phoneNumber;
return $this; return $this;
} }
@ -427,6 +439,7 @@ class UserData
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->phoneNumberPublic = $phoneNumberPublic; $this->phoneNumberPublic = $phoneNumberPublic;
return $this; return $this;
} }

View File

@ -16,7 +16,7 @@ use KekRozsak\FrontBundle\Entity\Group;
*/ */
class UserGroupMembership 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->setUser($user);
$this->setGroup($group); $this->setGroup($group);
@ -64,6 +64,7 @@ class UserGroupMembership
{ {
// TODO: Check if not null! // TODO: Check if not null!
$this->user = $user; $this->user = $user;
return $this; return $this;
} }
@ -96,6 +97,7 @@ class UserGroupMembership
public function setGroup(Group $group) public function setGroup(Group $group)
{ {
$this->group = $group; $this->group = $group;
return $this; return $this;
} }
@ -128,6 +130,7 @@ class UserGroupMembership
{ {
// TODO: Check if null! // TODO: Check if null!
$this->membershipRequestedAt = $membershipRequestedAt; $this->membershipRequestedAt = $membershipRequestedAt;
return $this; return $this;
} }
@ -159,6 +162,7 @@ class UserGroupMembership
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null) public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
{ {
$this->membershipAcceptedAt = $membershipAcceptedAt; $this->membershipAcceptedAt = $membershipAcceptedAt;
return $this; return $this;
} }
@ -188,9 +192,10 @@ class UserGroupMembership
* @param KekRozsak\SecurityBundle\Entity\User * @param KekRozsak\SecurityBundle\Entity\User
* @return UserGroupMembership * @return UserGroupMembership
*/ */
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null) public function setMembershipAcceptedBy(User $membershipAcceptedBy = null)
{ {
$this->membershipAcceptedBy = $membershipAcceptedBy; $this->membershipAcceptedBy = $membershipAcceptedBy;
return $this; return $this;
} }

View File

@ -138,4 +138,3 @@
{% block bottomscripts %}{% endblock %} {% block bottomscripts %}{% endblock %}
</body> </body>
</html> </html>

View File

@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
// Here you should define the parameters that are allowed to // Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for // configure your bundle. See the documentation linked above for
// more information on that topic. // more information on that topic.
return $treeBuilder; return $treeBuilder;
} }
} }

View File

@ -5,8 +5,6 @@ namespace KekRozsak\SecurityBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\Role\RoleInterface; use Symfony\Component\Security\Core\Role\RoleInterface;
use KekRozsak\SecurityBundle\Entity\User;
/** /**
* KekRozsak\SecurityBundle\Entity\Role * KekRozsak\SecurityBundle\Entity\Role
* *
@ -55,6 +53,7 @@ class Role implements RoleInterface
{ {
// TODO: Check if null or empty! // TODO: Check if null or empty!
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@ -86,6 +85,7 @@ class Role implements RoleInterface
{ {
// TODO: Check if parameter is boolean! // TODO: Check if parameter is boolean!
$this->default = $default; $this->default = $default;
return $this; return $this;
} }
@ -107,6 +107,7 @@ class Role implements RoleInterface
public function setDescription($description = null) public function setDescription($description = null)
{ {
$this->description = $description; $this->description = $description;
return $this; return $this;
} }
@ -146,6 +147,7 @@ class Role implements RoleInterface
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->shortDescription = $shortDescription; $this->shortDescription = $shortDescription;
return $this; return $this;
} }

View File

@ -70,6 +70,7 @@ class User implements UserInterface, AdvancedUserInterface
{ {
// TODO: check if null or empty! // TODO: check if null or empty!
$this->username = $username; $this->username = $username;
return $this; return $this;
} }
@ -102,6 +103,7 @@ class User implements UserInterface, AdvancedUserInterface
public function setPassword($password) public function setPassword($password)
{ {
$this->password = $password; $this->password = $password;
return $this; return $this;
} }
@ -134,6 +136,7 @@ class User implements UserInterface, AdvancedUserInterface
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->displayName = $displayName; $this->displayName = $displayName;
return $this; return $this;
} }
@ -166,6 +169,7 @@ class User implements UserInterface, AdvancedUserInterface
{ {
// TODO: Check if empty or null! // TODO: Check if empty or null!
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
@ -197,6 +201,7 @@ class User implements UserInterface, AdvancedUserInterface
public function setRegisteredAt(\DateTime $registeredAt) public function setRegisteredAt(\DateTime $registeredAt)
{ {
$this->registeredAt = $registeredAt; $this->registeredAt = $registeredAt;
return $this; return $this;
} }
@ -229,6 +234,7 @@ class User implements UserInterface, AdvancedUserInterface
public function setAcceptedBy(User $acceptedBy = null) public function setAcceptedBy(User $acceptedBy = null)
{ {
$this->acceptedBy = $acceptedBy; $this->acceptedBy = $acceptedBy;
return $this; return $this;
} }
@ -260,6 +266,7 @@ class User implements UserInterface, AdvancedUserInterface
public function setLastLoginAt(\DateTime $lastLoginAt = null) public function setLastLoginAt(\DateTime $lastLoginAt = null)
{ {
$this->lastLoginAt = $lastLoginAt; $this->lastLoginAt = $lastLoginAt;
return $this; return $this;
} }
@ -276,7 +283,7 @@ class User implements UserInterface, AdvancedUserInterface
/** /**
* The UserData object for this User * 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") * @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", fetch="LAZY", cascade={"persist"}, mappedBy="user")
*/ */
@ -285,20 +292,21 @@ class User implements UserInterface, AdvancedUserInterface
/** /**
* Set userData * Set userData
* *
* @param \KekRozsak\FrontBundle\Entity\UserData $userData * @param KekRozsak\FrontBundle\Entity\UserData $userData
* @return User * @return User
*/ */
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null) public function setUserData(UserData $userData = null)
{ {
$this->userData = $userData; $this->userData = $userData;
$userData->setUser($this); $userData->setUser($this);
return $this; return $this;
} }
/** /**
* Get userData * Get userData
* *
* @return \KekRozsak\FrontBundle\Entity\UserData * @return KekRozsak\FrontBundle\Entity\UserData
*/ */
public function getUserData() public function getUserData()
{ {
@ -326,6 +334,7 @@ class User implements UserInterface, AdvancedUserInterface
{ {
// TODO: Check if null! // TODO: Check if null!
$this->groups[] = $group; $this->groups[] = $group;
return $this; return $this;
} }
@ -358,6 +367,7 @@ class User implements UserInterface, AdvancedUserInterface
{ {
// TODO: Check if null! // TODO: Check if null!
$this->roles[] = $role; $this->roles[] = $role;
return $this; 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 * As we use crypt() to encode passwords, salt is always the same as the
* password * password
*/ */
return $this->password; return $this->password;
} }
@ -402,24 +413,28 @@ class User implements UserInterface, AdvancedUserInterface
public function isAccountNonExpired() public function isAccountNonExpired()
{ {
/* Currently, accounts never expire */ /* Currently, accounts never expire */
return true; return true;
} }
public function isAccountNonLocked() public function isAccountNonLocked()
{ {
/* Currently, accounts cannot be locked */ /* Currently, accounts cannot be locked */
return true; return true;
} }
public function isCredentialsNonExpired() public function isCredentialsNonExpired()
{ {
/* Currently, credentials never expire */ /* Currently, credentials never expire */
return true; return true;
} }
public function isEnabled() public function isEnabled()
{ {
/* Account is enabled if it is accepted by someone */ /* Account is enabled if it is accepted by someone */
return ($this->acceptedBy !== null); return ($this->acceptedBy !== null);
} }
} }

View File

@ -9,12 +9,12 @@ use JMS\DiExtraBundle\Annotation as DI;
*/ */
class CryptEncoder implements PasswordEncoderInterface class CryptEncoder implements PasswordEncoderInterface
{ {
function encodePassword($raw, $salt) public function encodePassword($raw, $salt)
{ {
return crypt($raw); return crypt($raw);
} }
function isPasswordValid($encoded, $raw, $salt) public function isPasswordValid($encoded, $raw, $salt)
{ {
return (crypt($raw, $salt) == $encoded); return (crypt($raw, $salt) == $encoded);
} }