I already know how to get field names for entity, but how to get class names for all associations also?
$em->getClassMetadata('Product')->getFieldNames();
This gets class property only, but I expect to get association names inside nested array, for example if I have customer associated to product I would like to get all customer class property names too.
You can get the associated field names as well then merge them
$properties = $em->getClassMetadata('YourBundle:Product')->getFieldNames();
$output = array_merge(
$properties,
$em->getClassMetadata('YourBundle:Product')->getAssociationNames()
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With