Skip to content

Commit

Permalink
AENV-540 - Make name/title field consistent for playlists api - impro…
Browse files Browse the repository at this point in the history
…vements
  • Loading branch information
takeit committed Oct 16, 2015
1 parent 978cfab commit 8bb5849
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
32 changes: 20 additions & 12 deletions newscoop/library/Newscoop/Entity/Playlist.php
Expand Up @@ -30,7 +30,7 @@ class Playlist extends AbstractEntity
*
* @var string
*/
protected $title;
protected $name;

/**
* @ORM\Column(length=1024, name="notes", nullable=true)
Expand Down Expand Up @@ -121,35 +121,43 @@ public function getArticlesLink()
}

/**
* Returns the title of the playlist.
* Returns the name of the playlist.
*/
public function getName()
{
return $this->title;
return $this->name;
}

/**
* Returns the title of the playlist.
* Returns the name of the playlist.
*
* @var string
*/
public function setName($title)
public function setName($name)
{
$this->title = $title;
$this->name = $name;

return $this;
}

public function getTitle()
/**
* Returns the name of the playlist.
*
* @var string
*/
public function setTitle($name)
{
return $this->title;
$this->name = $name;

return $this;
}

public function setTitle($title)
/**
* Returns the name of the playlist.
*/
public function getTitle()
{
$this->title = $title;

return $this;
return $this->name;
}

/**
Expand Down
Expand Up @@ -194,7 +194,6 @@ public function save(Playlist $playlist = null, $articles = null)
$em->getConnection()->beginTransaction();

try {

$em->persist($playlist);
if (is_null($playlist->getId())) {
$em->flush();
Expand Down
Expand Up @@ -16,7 +16,7 @@ class PlaylistType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', 'text', array(
->add('name', 'text', array(
'required' => true,
))
->add('notes', 'text', array(
Expand Down
Expand Up @@ -7,12 +7,12 @@ Newscoop\Entity\Playlist:
type: integer
groups: ["list", "details"]
serialized_name: id
title:
name:
expose: true
read_only: true
type: string
groups: ["list", "details"]
serialized_name: title
serialized_name: name
notes:
expose: true
read_only: true
Expand Down
Expand Up @@ -39,6 +39,7 @@ angular.module('playlistsApp').factory('Playlist', [
.success(function (response) {
if (response.items !== undefined) {
response.items.forEach(function (item) {
item.title = item.name;
playlists.push(item);
});

Expand Down Expand Up @@ -278,7 +279,7 @@ angular.module('playlistsApp').factory('Playlist', [

var formData = {
playlist: {
title: playlist.title
name: playlist.title
}
};

Expand Down Expand Up @@ -347,7 +348,7 @@ angular.module('playlistsApp').factory('Playlist', [

var formData = {
playlist: {
title: playlist.title
name: playlist.title
}
};

Expand Down

0 comments on commit 8bb5849

Please sign in to comment.