Jump to content

trackChanges does not track everything of an object?


Guy Verville
 Share

Recommended Posts

Hi,

I thought I understood $object->trackChanges() behavior, but I am not so sure now.

The code below

if($p->parent_id != $dataBundle["parent"]) {
   $p->parent_id = $dataBundle["parent"];
}

or this one

$p->setLanguageValue("francais", "crm_description", $data['DescriptionFrancais']);

is not recorded, while this one is

$p->crm_description = $data['DescriptionEnglish'];

I try to make a log file for a synchronization process with this code:

$message = "<p><a href='$existingPage->httpUrl'>" . $existingPage->title;
  $message .= "</a> a été modifié (" . $existingPage->template . "). Changements aux champs => ";
  $messag .= implode("<br/>", $existingPage->getChanges());

 

Any idea?

Link to comment
Share on other sites

Hi Zeka,

Unfortunately, changing to

$existingPage->setTrackChanges(Wire::trackChangesOn | Wire::trackChangesValues);

does not worked.

I realized though that putting true in getChanges, gives me an array of all the values of the field.

$changes = $existingPage->getChanges(true);
$implodedChange = "";
foreach($changes as $key => $change){
	$implodedChange .= $key . "=>" . implode(",",$change) . "<br/>";
}

However, the $existingPage->parent_id is still not caught...

I think I will have to track this with my own code.

Edited by Guy Verville
completion of message
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...