mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 21:26:37 +00:00
Stream model update, test migrate script, StreamsController inside Stations module.
This commit is contained in:
parent
37747e9c3e
commit
2c6cfd5ecb
|
@ -18,6 +18,7 @@ class Station extends \DF\Doctrine\Entity
|
|||
$this->requests_enabled = 0;
|
||||
$this->hide_if_inactive = 0;
|
||||
|
||||
$this->streams = new ArrayCollection;
|
||||
$this->history = new ArrayCollection;
|
||||
$this->managers = new ArrayCollection;
|
||||
$this->short_urls = new ArrayCollection;
|
||||
|
@ -176,6 +177,11 @@ class Station extends \DF\Doctrine\Entity
|
|||
/** @Column(name="deleted_at", type="datetime", nullable=true) */
|
||||
protected $deleted_at;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="StationStream", mappedBy="station")
|
||||
*/
|
||||
protected $streams;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="SongHistory", mappedBy="station")
|
||||
* @OrderBy({"timestamp" = "DESC"})
|
||||
|
|
|
@ -33,8 +33,8 @@ class StationStream extends \DF\Doctrine\Entity
|
|||
/** @Column(name="type", type="string", length=50, nullable=true) */
|
||||
protected $type;
|
||||
|
||||
/** @Column(name="listen_url", type="string", length=150, nullable=true) */
|
||||
protected $listen_url;
|
||||
/** @Column(name="stream_url", type="string", length=150, nullable=true) */
|
||||
protected $stream_url;
|
||||
|
||||
/** @Column(name="nowplaying_url", type="string", length=100, nullable=true) */
|
||||
protected $nowplaying_url;
|
||||
|
@ -42,4 +42,11 @@ class StationStream extends \DF\Doctrine\Entity
|
|||
/** @Column(name="nowplaying_data", type="json", nullable=true) */
|
||||
protected $nowplaying_data;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="Station", inversedBy="streams")
|
||||
* @JoinColumns({
|
||||
* @JoinColumn(name="station_id", referencedColumnName="id", onDelete="CASCADE")
|
||||
* })
|
||||
*/
|
||||
protected $station;
|
||||
}
|
11
app/modules/stations/controllers/StreamsController.php
Normal file
11
app/modules/stations/controllers/StreamsController.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
use \Entity\Station;
|
||||
use \Entity\StationStream;
|
||||
|
||||
class Stations_StreamsController extends \PVL\Controller\Action\Station
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
26
web/test.php
Normal file
26
web/test.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
require_once dirname(__FILE__) . '/../app/bootstrap.php';
|
||||
$application->bootstrap();
|
||||
|
||||
$em = \Zend_Registry::get('em');
|
||||
|
||||
// Delete all current streams.
|
||||
$em->createQuery('DELETE FROM Entity\StationStream')->execute();
|
||||
|
||||
// Get all current stations.
|
||||
$stations = $em->createQuery('SELECT s FROM Entity\Station s')->execute();
|
||||
|
||||
foreach($stations as $station)
|
||||
{
|
||||
// Create new stream record.
|
||||
$stream = new Entity\StationStream;
|
||||
$stream->station = $station;
|
||||
|
||||
$stream->is_default = true;
|
||||
$stream->name = 'Main Stream';
|
||||
$stream->type = $station->type;
|
||||
$stream->stream_url = $station->stream_url;
|
||||
$stream->nowplaying_url = $station->nowplaying_url;
|
||||
$stream->nowplaying_data = $station->nowplaying_data;
|
||||
$stream->save();
|
||||
}
|
Loading…
Reference in New Issue
Block a user