This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
/
Artist.php
executable file
·54 lines (46 loc) · 1.59 KB
/
Artist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Tekstove\ApiBundle\Model;
use Tekstove\ApiBundle\Model\Base\Artist as BaseArtist;
use Tekstove\ApiBundle\Model\Artist\Exception\ArtistHumanReadableException;
use Propel\Runtime\Connection\ConnectionInterface;
/**
* Skeleton subclass for representing a row from the 'artist' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class Artist extends BaseArtist implements Acl\EditableInterface, Acl\AutoAclSerializableInterface
{
use AclTrait;
use \Tekstove\ApiBundle\Validator\ValidationAwareTrait;
use \Tekstove\ApiBundle\EventDispatcher\EventDispatcherAwareTrait;
public function preSave(ConnectionInterface $con = null)
{
if (!$this->validate($this->getValidator())) {
$errors = $this->getValidationFailures();
$exception = new ArtistHumanReadableException('Validation failed.');
foreach ($errors as $error) {
/* @var $error \Symfony\Component\Validator\ConstraintViolationInterface */
$exception->addError($error->getPropertyPath(), $error->getMessage());
}
throw $exception;
}
// $this->notifyPreSave($this);
return parent::preSave($con);
}
/**
* @return Album[]
*/
public function getAlbums()
{
$return = [];
foreach ($this->getAlbumArtists() as $albumArtist) {
$return[] = $albumArtist->getAlbum();
}
return $return;
}
}