Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Backend Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Backend Server
Commits
ca00bc0b
Commit
ca00bc0b
authored
Jul 19, 2020
by
SpinShare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added badge entities
parent
087b16c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
275 additions
and
0 deletions
+275
-0
src/Entity/Badge.php
src/Entity/Badge.php
+117
-0
src/Entity/UserBadge.php
src/Entity/UserBadge.php
+58
-0
src/Repository/BadgeRepository.php
src/Repository/BadgeRepository.php
+50
-0
src/Repository/UserBadgeRepository.php
src/Repository/UserBadgeRepository.php
+50
-0
No files found.
src/Entity/Badge.php
0 → 100644
View file @
ca00bc0b
<?php
namespace
App\Entity
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\Common\Collections\Collection
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
* @ORM\Entity(repositoryClass="App\Repository\BadgeRepository")
*/
class
Badge
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private
$id
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$title
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$description
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$icon
;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserBadge", mappedBy="badge")
*/
private
$users
;
public
function
__construct
()
{
$this
->
users
=
new
ArrayCollection
();
}
public
function
getId
()
:
?
int
{
return
$this
->
id
;
}
public
function
getTitle
()
:
?
string
{
return
$this
->
title
;
}
public
function
setTitle
(
string
$title
)
:
self
{
$this
->
title
=
$title
;
return
$this
;
}
public
function
getDescription
()
:
?
string
{
return
$this
->
description
;
}
public
function
setDescription
(
string
$description
)
:
self
{
$this
->
description
=
$description
;
return
$this
;
}
public
function
getIcon
()
:
?
string
{
return
$this
->
icon
;
}
public
function
setIcon
(
string
$icon
)
:
self
{
$this
->
icon
=
$icon
;
return
$this
;
}
/**
* @return Collection|UserBadge[]
*/
public
function
getUsers
()
:
Collection
{
return
$this
->
users
;
}
public
function
addUser
(
UserBadge
$user
)
:
self
{
if
(
!
$this
->
users
->
contains
(
$user
))
{
$this
->
users
[]
=
$user
;
$user
->
setBadge
(
$this
);
}
return
$this
;
}
public
function
removeUser
(
UserBadge
$user
)
:
self
{
if
(
$this
->
users
->
contains
(
$user
))
{
$this
->
users
->
removeElement
(
$user
);
// set the owning side to null (unless already changed)
if
(
$user
->
getBadge
()
===
$this
)
{
$user
->
setBadge
(
null
);
}
}
return
$this
;
}
}
src/Entity/UserBadge.php
0 → 100644
View file @
ca00bc0b
<?php
namespace
App\Entity
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
* @ORM\Entity(repositoryClass="App\Repository\UserBadgeRepository")
*/
class
UserBadge
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private
$id
;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Badge", inversedBy="users")
* @ORM\JoinColumn(nullable=false)
*/
private
$badge
;
/**
* @ORM\Column(type="date")
*/
private
$givenDate
;
public
function
getId
()
:
?
int
{
return
$this
->
id
;
}
public
function
getBadge
()
:
?
Badge
{
return
$this
->
badge
;
}
public
function
setBadge
(
?
Badge
$badge
)
:
self
{
$this
->
badge
=
$badge
;
return
$this
;
}
public
function
getGivenDate
()
:
?
\DateTimeInterface
{
return
$this
->
givenDate
;
}
public
function
setGivenDate
(
\DateTimeInterface
$givenDate
)
:
self
{
$this
->
givenDate
=
$givenDate
;
return
$this
;
}
}
src/Repository/BadgeRepository.php
0 → 100644
View file @
ca00bc0b
<?php
namespace
App\Repository
;
use
App\Entity\Badge
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\Persistence\ManagerRegistry
;
/**
* @method Badge|null find($id, $lockMode = null, $lockVersion = null)
* @method Badge|null findOneBy(array $criteria, array $orderBy = null)
* @method Badge[] findAll()
* @method Badge[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class
BadgeRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
Badge
::
class
);
}
// /**
// * @return Badge[] Returns an array of Badge objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->orderBy('b.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Badge
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
src/Repository/UserBadgeRepository.php
0 → 100644
View file @
ca00bc0b
<?php
namespace
App\Repository
;
use
App\Entity\UserBadge
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\Persistence\ManagerRegistry
;
/**
* @method UserBadge|null find($id, $lockMode = null, $lockVersion = null)
* @method UserBadge|null findOneBy(array $criteria, array $orderBy = null)
* @method UserBadge[] findAll()
* @method UserBadge[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class
UserBadgeRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
UserBadge
::
class
);
}
// /**
// * @return UserBadge[] Returns an array of UserBadge objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->orderBy('u.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?UserBadge
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment