Open Doreitor opened 2 years ago
`public function findByFeatured(Request $request) { $entityManager = $this->getEntityManager();
$region = $request->attributes->get('_region');
$language = $request->attributes->get('_locale');
$query = $entityManager->createQuery(
"SELECT i FROM App\Entity\Insight i INNER JOIN i.translations t
WHERE i.regions LIKE :region AND i.languages LIKE :language AND t.locale LIKE :local AND i.published = true
ORDER BY t.title ASC "
)->setParameters(array(
'language' => '%'.$language.'%',
'region' => '%'.$region.'%',
'local' => '%'.$language.'%',
));
return $query->getResult();
}`
CREATE TABLE [dbo].[Insight]( [id] [int] IDENTITY(1,1) NOT NULL, [home_id] [int] NULL, [createdAt] [datetime2](6) NULL, [updatedAt] [datetime2](6) NULL, [languages] [varchar](max) NOT NULL, [regions] [varchar](max) NOT NULL, [metaRobots] [nvarchar](128) NULL, [published] [bit] NULL, [headerType] [nvarchar](64) NOT NULL, [showIntroBlock] [bit] NOT NULL, [showKnowledgeBlock] [bit] NOT NULL, [showEventsBlock] [bit] NOT NULL, [showLegalNoveltiesBlock] [bit] NOT NULL, [showCaseStudiesBlock] [bit] NOT NULL, [oldId] [int] NULL, [showTeamsBlock] [bit] NULL, [featured] [bit] NULL, [private] [bit] NULL, [activity_id] [int] NULL)
CREATE TABLE [dbo].[InsightTranslation]( [id] [int] IDENTITY(1,1) NOT NULL, [translatable_id] [int] NULL, [title] [nvarchar](255) NOT NULL, [summary] [varchar](max) NULL, [description] [varchar](max) NULL, [slug] [nvarchar](128) NOT NULL, [metaTitle] [nvarchar](255) NULL, [metaDescription] [nvarchar](255) NULL, [locale] [nvarchar](255) NOT NULL)
Environment
Composer packages
PHP version
Subject
[Semantical Error] line 0, col 61 near 't ': Error: App\Entity\Insight has no association named translations
Steps to reproduce
SQL Server
Expected results
Actual results
Doctrine\ORM\Query\ QueryException SELECT i FROM App\Entity\Insight i INNER JOIN i.translations t WHERE i.regions LIKE :region AND i.languages LIKE :language AND t.locale LIKE :local AND i.published = true ORDER BY t.title ASC