I want to make a Hook to handle "afterSave" event for getting the attached "Worklogs" entity [as comments] attached to another "AccountOpening" entity. I made this code but It didn't run:
$entityManager = $this->getEntityManager();
$account = getEntity('Account', $accountId);
$record = $entity->get('id');
$parentAccountOpening = $entity->get('id');
$relatedAccountOpening = $entity->get('accountOpeningsIds');
$list = $entityManager->getRepository('AccountOpening')->findRelated($entity, 'workLogs');
$listA = $list->toArray();
for($i = 0 ; $i < count($listA) ; $i++){
$entity->set('description' ,$listA[$i]);
}
and tried another way but also not successful:
$accountOpening =$entityManager->getRepository('WorkLog')->find();
$workLogs = $entityManager->getRepository('AccountOpening')->findRelated($entity, 'workLogs');
$entity->set('description', $workLogs->id);
$entityManager = $this->getEntityManager();
$account = getEntity('Account', $accountId);
$record = $entity->get('id');
$parentAccountOpening = $entity->get('id');
$relatedAccountOpening = $entity->get('accountOpeningsIds');
$list = $entityManager->getRepository('AccountOpening')->findRelated($entity, 'workLogs');
$listA = $list->toArray();
for($i = 0 ; $i < count($listA) ; $i++){
$entity->set('description' ,$listA[$i]);
}
and tried another way but also not successful:
$accountOpening =$entityManager->getRepository('WorkLog')->find();
$workLogs = $entityManager->getRepository('AccountOpening')->findRelated($entity, 'workLogs');
$entity->set('description', $workLogs->id);
Comment