I recently started using Symfony
and I don't understand why statuses
(ManyToMany) don't give any output on a findAll
query.
I need there the last/current value that was entered in the database.
App\Entity\Service {#752 ▼
-id: 5
-name: "Helpdesk"
-description: null
-url: null
-serviceGroup: App\Entity\ServiceGroup {#728 ▼
-id: 2
-name: "Webserver 2"
-description: null
-services: Doctrine\ORM\PersistentCollection {#729 ▶}
-order_id: 2
}
-order_id: 3
-statuses: Doctrine\ORM\PersistentCollection {#753 ▼
-snapshot: []
-owner: App\Entity\Service {#752}
-association: array:16 [ …16]
-em: Doctrine\ORM\EntityManager {#383 …11}
-backRefFieldName: "services"
-typeClass: Doctrine\ORM\Mapping\ClassMetadata {#675 …}
-isDirty: false
#collection: Doctrine\Common\Collections\ArrayCollection {#754 ▶}
#initialized: false
}
}
//Edit for easyadmin I have already added a function in the Entity/Service.php, can't I just use this for the twig tempalte?
public function getLastStatus()
{
return $this->getStatuses()->last();
}