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
e8c9e324
Commit
e8c9e324
authored
Oct 14, 2020
by
Andreas Heimann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add playlist entity
parent
f9c89e6f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
213 additions
and
0 deletions
+213
-0
src/Entity/Song.php
src/Entity/Song.php
+34
-0
src/Entity/SongPlaylist.php
src/Entity/SongPlaylist.php
+129
-0
src/Repository/SongPlaylistRepository.php
src/Repository/SongPlaylistRepository.php
+50
-0
No files found.
src/Entity/Song.php
View file @
e8c9e324
...
@@ -118,10 +118,16 @@ class Song
...
@@ -118,10 +118,16 @@ class Song
*/
*/
private
$spinPlays
;
private
$spinPlays
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\SongPlaylist", mappedBy="songs")
*/
private
$songPlaylists
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
reviews
=
new
ArrayCollection
();
$this
->
reviews
=
new
ArrayCollection
();
$this
->
spinPlays
=
new
ArrayCollection
();
$this
->
spinPlays
=
new
ArrayCollection
();
$this
->
songPlaylists
=
new
ArrayCollection
();
}
}
public
function
getId
()
:
?
int
public
function
getId
()
:
?
int
...
@@ -437,4 +443,32 @@ class Song
...
@@ -437,4 +443,32 @@ class Song
return
$response
;
return
$response
;
}
}
/**
* @return Collection|SongPlaylist[]
*/
public
function
getSongPlaylists
()
:
Collection
{
return
$this
->
songPlaylists
;
}
public
function
addSongPlaylist
(
SongPlaylist
$songPlaylist
)
:
self
{
if
(
!
$this
->
songPlaylists
->
contains
(
$songPlaylist
))
{
$this
->
songPlaylists
[]
=
$songPlaylist
;
$songPlaylist
->
addSong
(
$this
);
}
return
$this
;
}
public
function
removeSongPlaylist
(
SongPlaylist
$songPlaylist
)
:
self
{
if
(
$this
->
songPlaylists
->
contains
(
$songPlaylist
))
{
$this
->
songPlaylists
->
removeElement
(
$songPlaylist
);
$songPlaylist
->
removeSong
(
$this
);
}
return
$this
;
}
}
}
src/Entity/SongPlaylist.php
0 → 100644
View file @
e8c9e324
<?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\SongPlaylistRepository")
*/
class
SongPlaylist
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private
$id
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$title
;
/**
* @ORM\Column(type="text", nullable=true)
*/
private
$description
;
/**
* @ORM\Column(type="string", length=255)
*/
private
$fileReference
;
/**
* @ORM\Column(type="boolean")
*/
private
$isOfficial
;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Song", inversedBy="songPlaylists")
*/
private
$songs
;
public
function
__construct
()
{
$this
->
songs
=
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
getFileReference
()
:
?
string
{
return
$this
->
fileReference
;
}
public
function
setFileReference
(
string
$fileReference
)
:
self
{
$this
->
fileReference
=
$fileReference
;
return
$this
;
}
public
function
getIsOfficial
()
:
?
bool
{
return
$this
->
isOfficial
;
}
public
function
setIsOfficial
(
bool
$isOfficial
)
:
self
{
$this
->
isOfficial
=
$isOfficial
;
return
$this
;
}
/**
* @return Collection|Song[]
*/
public
function
getSongs
()
:
Collection
{
return
$this
->
songs
;
}
public
function
addSong
(
Song
$song
)
:
self
{
if
(
!
$this
->
songs
->
contains
(
$song
))
{
$this
->
songs
[]
=
$song
;
}
return
$this
;
}
public
function
removeSong
(
Song
$song
)
:
self
{
if
(
$this
->
songs
->
contains
(
$song
))
{
$this
->
songs
->
removeElement
(
$song
);
}
return
$this
;
}
}
src/Repository/SongPlaylistRepository.php
0 → 100644
View file @
e8c9e324
<?php
namespace
App\Repository
;
use
App\Entity\SongPlaylist
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\Persistence\ManagerRegistry
;
/**
* @method SongPlaylist|null find($id, $lockMode = null, $lockVersion = null)
* @method SongPlaylist|null findOneBy(array $criteria, array $orderBy = null)
* @method SongPlaylist[] findAll()
* @method SongPlaylist[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class
SongPlaylistRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
SongPlaylist
::
class
);
}
// /**
// * @return SongPlaylist[] Returns an array of SongPlaylist 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): ?SongPlaylist
{
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