for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Uxmp\Core\Orm\Repository;
use Doctrine\ORM\EntityRepository;
use Uxmp\Core\Orm\Model\Artist;
use Uxmp\Core\Orm\Model\ArtistInterface;
/**
* @extends EntityRepository<ArtistInterface>
*/
final class ArtistRepository extends EntityRepository implements ArtistRepositoryInterface
{
public function prototype(): ArtistInterface
return new Artist();
}
public function save(ArtistInterface $artist): void
$this->getEntityManager()->persist($artist);
$this->getEntityManager()->flush();
public function delete(ArtistInterface $artist): void
$this->getEntityManager()->remove($artist);
public function findByMbId(string $mbid): ?ArtistInterface
return $this->findOneBy([
'mbid' => $mbid,
]);
public function getAllHavingNoRelations(): iterable
return $this->getEntityManager()
->createQuery(
<<<DQL
SELECT artist
FROM Uxmp\Core\Orm\Model\Artist artist
LEFT JOIN Uxmp\Core\Orm\Model\Album album
WITH album.artist_id = artist.id
GROUP BY artist HAVING COUNT(album.id) = 0
DQL
)
->toIterable();