wenn diese Abfrage auszuführen versucht, es beschwert sich:Symfony Lehre createQueryBuilder Von() alias nicht funktioniert
[2/2] QueryException: [Semantical Error] line 0, col 443 near 'User user LEFT': Error: Class 'User' is not defined.
ich wirklich weiß nicht einmal, warum ich den Alias in meiner aus brauchen, aber ich hinzugefügt, um es dort und es funktioniert nicht.
Der Name Entity-Klasse ist "User"
$query = $em->createQueryBuilder()
->from('User','user')
->select('user.email,
person.givenName,
person.familyName,
contactPoint.contactInfo,
organization.legalName,
postalAddress.streetAddress1,
postalAddress.streetAddress2,
postalAddress.city,
postalAddress.postalCode,
country.name,
region.name')
->leftJoin('person', 'WITH', "user.person_id=person.id")
->leftJoin('contactPoint', 'WITH', "person.contactPoint_id=contactPoint.id")
->leftJoin('organization', 'WITH', "person.organization_id=organization.id")
->leftJoin('postalAddress', 'WITH', "organization.postal_address_id=postalAddress.id")
->leftJoin('country', 'WITH', "postalAddress.country_id=country.id")
->leftJoin('region', 'WITH', "postalAddress.region_id=region.id")
->where("user.email = '$email' ")
->getQuery();
dump($query->getArrayResult());die();
//////////////////// ARBEITS QUERY AKTUALISIERT Sie
$user = $this->get('security.token_storage')->getToken()->getUser();
$email = $user->getEmail();
$query = $em->createQueryBuilder()
->from(User::class,'user')
->select('user.email,
person.givenName,
person.familyName,
contactPoint.contactInfo,
organization.legalName,
postalAddress.streetAddress1,
postalAddress.streetAddress2,
postalAddress.city,
postalAddress.postalCode,
country.name,
region.name')
->leftJoin(Person::class, 'person', 'WITH', "user.accountOwner=person.id")
->leftJoin(ContactPoint::class, 'contactPoint', 'WITH', "person.contactPoint=contactPoint.id")
->leftJoin(Organization::class, 'organization', 'WITH', "person.organization=organization.id")
->leftJoin(PostalAddress::class, 'postalAddress', 'WITH', "organization.postalAddress=postalAddress.id")
->leftJoin(Country::class, 'country', 'WITH', "postalAddress.country=country.id")
->leftJoin(Region::class, 'region', 'WITH', "postalAddress.region=region.id")
->where("user.email = '$email' ")
->getQuery();
dump($query->getResult());die();
Hier ist die Arbeits Abfrage überarbeitet – user1930591