php - How to refresh child object in doctrine


I have 2 table property and property_type

property's columns: id, name, property_type_id, style, ...., status, create_at, update_at

property_type's columns: id, name, status, create_at, update_at

property_type_id column is mapping with property_type table

Here my code

    $entityManager = $this->getDoctrine()->getManager();
    $propertyData = $entityManager->getRepository('PropertyBundle:Property')->find(4);
    $propertyType = $propertyData->getPropertyTypeId();

    if($propertyData->getStatus() == 1) {
    } else if($propertyData->getStatus() == 2) {

   if($propertyData->getStyle() == 1) {
       // only refresh $propertyType object

I am trying to refresh only $propertyType but according above code $propertyType and $propertyData both objects are getting refreshed.

People are also looking for solutions to the problem: javascript - PHP AES Encryption into NodeJS using crypto module


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.