Nettrine ORM + Translatable + Sluggable

xhtmlkoder
Člen | 15
+
0
-

Ahoj, pokousim se o funkci hledani prekladaneho slugu pomoci hintu TranslatableListener::HINT_TRANSLATABLE_LOCALE. Ale ne a ne na to prijit. Pouzivam Nettrine ORM (stable) s rozsirenim Atlantic18 a Translatable + Sluggable. Preklady funguji v pohode pri nacteni z db. Ale ne a ne rozchodit funkci pro hledani. Resili jste to nekdo?

Ja se pokousim o funkci v repositari:

public function findOneBySlug($slug)
	{
		Debugger::$maxDepth = 6;
		$qb = $this->createQueryBuilder('n')
			->select('t.id')
			->from(Type::class, 't')
			->where('t.slug = :slug')
			->setParameter('slug', $slug);
		$result = $qb->getQuery()
			->useQueryCache(false)
			->setHint(
				Query::HINT_CUSTOM_OUTPUT_WALKER,
				'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'
			)
			->setHint(TranslatableListener::HINT_TRANSLATABLE_LOCALE, 'cs')
			->setHint(
				\Gedmo\Translatable\TranslatableListener::HINT_FALLBACK,
				1
			);

		dump($result->getSingleResult());die();

		return $qb->getResult();
	}

Nicmene zpet dostanu chybu a nevim jak se s tim poprat:

Doctrine\DBAL\Exception\TableNotFoundException

An exception occurred while executing 'SELECT b3_.id AS id_0 FROM boattype b0_, boattype b3_ LEFT JOIN boattype_translation t1_ ON t1_.locale = 'cs' AND t1_.field = 'title' AND t1_.object_id = b0_.id LEFT JOIN boattype_translation t2_ ON t2_.locale = 'cs' AND t2_.field = 'slug' AND t2_.object_id = b0_.id LEFT JOIN boattype_translation t4_ ON t4_.locale = 'cs' AND t4_.field = 'title' AND t4_.object_id = b3_.id LEFT JOIN boattype_translation t5_ ON t5_.locale = 'cs' AND t5_.field = 'slug' AND t5_.object_id = b3_.id WHERE (COALESCE(CAST(t5_.content AS VARCHAR(255)), b3_.slug) = ?) AND (b0_.deleted_at IS NULL) AND (b3_.deleted_at IS NULL)' with params ["katamaran"]:

SQLSTATE[42P01]: Undefined table: 7 ERROR:  invalid reference to FROM-clause entry for table "b0_"
LINE 1: ... 'cs' AND t1_.field = 'title' AND t1_.object_id = b0_.id LEF...
                                                             ^
HINT:  There is an entry for table "b0_", but it cannot be referenced from this part of the query.