Answer the question
In order to leave comments, you need to log in
Why doesn't modx's save() method work on an existing object?
Hi everybody! Can you please tell me why the save() method does not work for an existing object, although it works for a new one?
I try like this:
$test = $modx->getObject('LjValues', ['order_id' => 3, 'field_id' => 1]);
echo $test->get('value');
$test->set('value', "тестовый тест");
if($test->save() === true){
echo $test->get('value');
}
<object class="LjValues" table="lj_values" extends="xPDOSimpleObject">
<field key="field_id" dbtype="int" precision="11" phptype="integer" null="false" />
<field key="value" dbtype="varchar" precision="191" phptype="string" null="false" />
<field key="order_id" dbtype="int" precision="11" phptype="integer" null="false" />
<aggregate alias="LjFields" class="LjFields" local="field_id" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="LjOrders" class="LjOrders" local="order_id" foreign="id" cardinality="one" owner="foreign" />
</object>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question