Add retrieveLBC and retrieveNote for references

This commit is contained in:
Ryan Prather 2024-05-26 22:46:54 -04:00
parent 45a3398ac7
commit a46253ec7d

View File

@ -3,7 +3,9 @@
namespace App\Controller;
use App\Entity\Bible;
use App\Entity\Note;
use App\Entity\Reference;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
@ -172,4 +174,16 @@ class ReferenceController extends AbstractController
$r = self::$emi->getRepository(Reference::class)->findBy(['type' => $ref->getType(), 'ndx' => $ref->getNdx()]);
return $r[0];
}
public static function retrieveLBC($ref): Reference
{
$r = self::$emi->getRepository(Reference::class)->findBy(['type' => 'lbc', 'ndx' => $ref->getNdx()]);
return $r[0];
}
public static function retrieveNote(?User $user): array
{
$notes = self::$emi->getRepository(Note::class)->findBy(['user' => $user], ['date' => 'DESC']);
return $notes;
}
}