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
3dceb47a
Commit
3dceb47a
authored
May 11, 2020
by
SpinShare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added SongReview and SongSpinPlay entities
parent
cb44095a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
527 additions
and
0 deletions
+527
-0
src/Entity/Song.php
src/Entity/Song.php
+97
-0
src/Entity/SongReview.php
src/Entity/SongReview.php
+130
-0
src/Entity/SongSpinPlay.php
src/Entity/SongSpinPlay.php
+130
-0
src/Entity/User.php
src/Entity/User.php
+70
-0
src/Repository/SongReviewRepository.php
src/Repository/SongReviewRepository.php
+50
-0
src/Repository/SongSpinPlayRepository.php
src/Repository/SongSpinPlayRepository.php
+50
-0
No files found.
src/Entity/Song.php
View file @
3dceb47a
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
namespace
App\Entity
;
namespace
App\Entity
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\Common\Collections\Collection
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
/**
...
@@ -101,6 +103,27 @@ class Song
...
@@ -101,6 +103,27 @@ class Song
*/
*/
private
$uploadDate
;
private
$uploadDate
;
/**
* @ORM\Column(type="text", nullable=true)
*/
private
$description
;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SongReview", mappedBy="song", orphanRemoval=true)
*/
private
$reviews
;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SongSpinPlay", mappedBy="song", orphanRemoval=true)
*/
private
$spinPlays
;
public
function
__construct
()
{
$this
->
reviews
=
new
ArrayCollection
();
$this
->
spinPlays
=
new
ArrayCollection
();
}
public
function
getId
()
:
?
int
public
function
getId
()
:
?
int
{
{
return
$this
->
id
;
return
$this
->
id
;
...
@@ -309,4 +332,78 @@ class Song
...
@@ -309,4 +332,78 @@ class Song
return
$this
;
return
$this
;
}
}
public
function
getDescription
()
:
?
string
{
return
$this
->
description
;
}
public
function
setDescription
(
?
string
$description
)
:
self
{
$this
->
description
=
$description
;
return
$this
;
}
/**
* @return Collection|SongReview[]
*/
public
function
getReviews
()
:
Collection
{
return
$this
->
reviews
;
}
public
function
addReview
(
SongReview
$review
)
:
self
{
if
(
!
$this
->
reviews
->
contains
(
$review
))
{
$this
->
reviews
[]
=
$review
;
$review
->
setSong
(
$this
);
}
return
$this
;
}
public
function
removeReview
(
SongReview
$review
)
:
self
{
if
(
$this
->
reviews
->
contains
(
$review
))
{
$this
->
reviews
->
removeElement
(
$review
);
// set the owning side to null (unless already changed)
if
(
$review
->
getSong
()
===
$this
)
{
$review
->
setSong
(
null
);
}
}
return
$this
;
}
/**
* @return Collection|SongSpinPlay[]
*/
public
function
getSpinPlays
()
:
Collection
{
return
$this
->
spinPlays
;
}
public
function
addSpinPlay
(
SongSpinPlay
$spinPlay
)
:
self
{
if
(
!
$this
->
spinPlays
->
contains
(
$spinPlay
))
{
$this
->
spinPlays
[]
=
$spinPlay
;
$spinPlay
->
setSong
(
$this
);
}
return
$this
;
}
public
function
removeSpinPlay
(
SongSpinPlay
$spinPlay
)
:
self
{
if
(
$this
->
spinPlays
->
contains
(
$spinPlay
))
{
$this
->
spinPlays
->
removeElement
(
$spinPlay
);
// set the owning side to null (unless already changed)
if
(
$spinPlay
->
getSong
()
===
$this
)
{
$spinPlay
->
setSong
(
null
);
}
}
return
$this
;
}
}
}
src/Entity/SongReview.php
0 → 100644
View file @
3dceb47a
<?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\SongReviewRepository")
*/
class
SongReview
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private
$id
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\User", inversedBy="reviews")
*/
private
$user
;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Song", inversedBy="reviews")
* @ORM\JoinColumn(nullable=false)
*/
private
$song
;
/**
* @ORM\Column(type="boolean")
*/
private
$recommended
;
/**
* @ORM\Column(type="text", nullable=true)
*/
private
$comment
;
/**
* @ORM\Column(type="datetime")
*/
private
$reviewDate
;
public
function
__construct
()
{
$this
->
user
=
new
ArrayCollection
();
}
public
function
getId
()
:
?
int
{
return
$this
->
id
;
}
/**
* @return Collection|User[]
*/
public
function
getUser
()
:
Collection
{
return
$this
->
user
;
}
public
function
addUser
(
User
$user
)
:
self
{
if
(
!
$this
->
user
->
contains
(
$user
))
{
$this
->
user
[]
=
$user
;
}
return
$this
;
}
public
function
removeUser
(
User
$user
)
:
self
{
if
(
$this
->
user
->
contains
(
$user
))
{
$this
->
user
->
removeElement
(
$user
);
}
return
$this
;
}
public
function
getSong
()
:
?
Song
{
return
$this
->
song
;
}
public
function
setSong
(
?
Song
$song
)
:
self
{
$this
->
song
=
$song
;
return
$this
;
}
public
function
getRecommended
()
:
?
bool
{
return
$this
->
recommended
;
}
public
function
setRecommended
(
bool
$recommended
)
:
self
{
$this
->
recommended
=
$recommended
;
return
$this
;
}
public
function
getComment
()
:
?
string
{
return
$this
->
comment
;
}
public
function
setComment
(
?
string
$comment
)
:
self
{
$this
->
comment
=
$comment
;
return
$this
;
}
public
function
getReviewDate
()
:
?
\DateTimeInterface
{
return
$this
->
reviewDate
;
}
public
function
setReviewDate
(
\DateTimeInterface
$reviewDate
)
:
self
{
$this
->
reviewDate
=
$reviewDate
;
return
$this
;
}
}
src/Entity/SongSpinPlay.php
0 → 100644
View file @
3dceb47a
<?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\SongSpinPlayRepository")
*/
class
SongSpinPlay
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private
$id
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\User", inversedBy="spinPlays")
*/
private
$user
;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Song", inversedBy="spinPlays")
* @ORM\JoinColumn(nullable=false)
*/
private
$song
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$videoUrl
;
/**
* @ORM\Column(type="datetime")
*/
private
$submitDate
;
/**
* @ORM\Column(type="boolean")
*/
private
$isActive
;
public
function
__construct
()
{
$this
->
user
=
new
ArrayCollection
();
}
public
function
getId
()
:
?
int
{
return
$this
->
id
;
}
/**
* @return Collection|User[]
*/
public
function
getUser
()
:
Collection
{
return
$this
->
user
;
}
public
function
addUser
(
User
$user
)
:
self
{
if
(
!
$this
->
user
->
contains
(
$user
))
{
$this
->
user
[]
=
$user
;
}
return
$this
;
}
public
function
removeUser
(
User
$user
)
:
self
{
if
(
$this
->
user
->
contains
(
$user
))
{
$this
->
user
->
removeElement
(
$user
);
}
return
$this
;
}
public
function
getSong
()
:
?
Song
{
return
$this
->
song
;
}
public
function
setSong
(
?
Song
$song
)
:
self
{
$this
->
song
=
$song
;
return
$this
;
}
public
function
getVideoUrl
()
:
?
string
{
return
$this
->
videoUrl
;
}
public
function
setVideoUrl
(
string
$videoUrl
)
:
self
{
$this
->
videoUrl
=
$videoUrl
;
return
$this
;
}
public
function
getSubmitDate
()
:
?
\DateTimeInterface
{
return
$this
->
submitDate
;
}
public
function
setSubmitDate
(
\DateTimeInterface
$submitDate
)
:
self
{
$this
->
submitDate
=
$submitDate
;
return
$this
;
}
public
function
getIsActive
()
:
?
bool
{
return
$this
->
isActive
;
}
public
function
setIsActive
(
bool
$isActive
)
:
self
{
$this
->
isActive
=
$isActive
;
return
$this
;
}
}
src/Entity/User.php
View file @
3dceb47a
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
App\Entity
;
namespace
App\Entity
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\Common\Collections\Collection
;
use
FOS\UserBundle\Model\User
as
BaseUser
;
use
FOS\UserBundle\Model\User
as
BaseUser
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Doctrine\ORM\Mapping
as
ORM
;
...
@@ -34,9 +36,21 @@
...
@@ -34,9 +36,21 @@
*/
*/
private
$isPatreon
;
private
$isPatreon
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\SongReview", mappedBy="user")
*/
private
$reviews
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\SongSpinPlay", mappedBy="user")
*/
private
$spinPlays
;
public
function
__construct
()
public
function
__construct
()
{
{
parent
::
__construct
();
parent
::
__construct
();
$this
->
reviews
=
new
ArrayCollection
();
$this
->
spinPlays
=
new
ArrayCollection
();
// your own logic
// your own logic
}
}
...
@@ -75,4 +89,60 @@
...
@@ -75,4 +89,60 @@
return
$this
;
return
$this
;
}
}
/**
* @return Collection|SongReview[]
*/
public
function
getReviews
()
:
Collection
{
return
$this
->
reviews
;
}
public
function
addReview
(
SongReview
$review
)
:
self
{
if
(
!
$this
->
reviews
->
contains
(
$review
))
{
$this
->
reviews
[]
=
$review
;
$review
->
addUser
(
$this
);
}
return
$this
;
}
public
function
removeReview
(
SongReview
$review
)
:
self
{
if
(
$this
->
reviews
->
contains
(
$review
))
{
$this
->
reviews
->
removeElement
(
$review
);
$review
->
removeUser
(
$this
);
}
return
$this
;
}
/**
* @return Collection|SongSpinPlay[]
*/
public
function
getSpinPlays
()
:
Collection
{
return
$this
->
spinPlays
;
}
public
function
addSpinPlay
(
SongSpinPlay
$spinPlay
)
:
self
{
if
(
!
$this
->
spinPlays
->
contains
(
$spinPlay
))
{
$this
->
spinPlays
[]
=
$spinPlay
;
$spinPlay
->
addUser
(
$this
);
}
return
$this
;
}
public
function
removeSpinPlay
(
SongSpinPlay
$spinPlay
)
:
self
{
if
(
$this
->
spinPlays
->
contains
(
$spinPlay
))
{
$this
->
spinPlays
->
removeElement
(
$spinPlay
);
$spinPlay
->
removeUser
(
$this
);
}
return
$this
;
}
}
}
\ No newline at end of file
src/Repository/SongReviewRepository.php
0 → 100644
View file @
3dceb47a
<?php
namespace
App\Repository
;
use
App\Entity\SongReview
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\Common\Persistence\ManagerRegistry
;
/**
* @method SongReview|null find($id, $lockMode = null, $lockVersion = null)
* @method SongReview|null findOneBy(array $criteria, array $orderBy = null)
* @method SongReview[] findAll()
* @method SongReview[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class
SongReviewRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
SongReview
::
class
);
}
// /**
// * @return SongReview[] Returns an array of SongReview objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('s')
->andWhere('s.exampleField = :val')
->setParameter('val', $value)
->orderBy('s.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?SongReview
{
return $this->createQueryBuilder('s')
->andWhere('s.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
src/Repository/SongSpinPlayRepository.php
0 → 100644
View file @
3dceb47a
<?php
namespace
App\Repository
;
use
App\Entity\SongSpinPlay
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\Common\Persistence\ManagerRegistry
;
/**
* @method SongSpinPlay|null find($id, $lockMode = null, $lockVersion = null)
* @method SongSpinPlay|null findOneBy(array $criteria, array $orderBy = null)
* @method SongSpinPlay[] findAll()
* @method SongSpinPlay[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class
SongSpinPlayRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
SongSpinPlay
::
class
);
}
// /**
// * @return SongSpinPlay[] Returns an array of SongSpinPlay objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('s')
->andWhere('s.exampleField = :val')
->setParameter('val', $value)
->orderBy('s.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?SongSpinPlay
{
return $this->createQueryBuilder('s')
->andWhere('s.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