I
I
ismatus2018-10-10 15:50:07
Yii
ismatus, 2018-10-10 15:50:07

Can you please tell me how to delete a model instance in Yii 2 after performing all operations with it?

Let's say I declare a model instance: And I get some data from the user that I need to save:
$customer = new Customer();

$customer->last_name = $post['last_name'];
$customer->fist_name = $post['first_name'];
$customer->patronymic = $post['patronymic'];
$customer->birth_date = $post['birth_date'];
if (!$customer->save()) {
   echo "Ошибка добавления клиента ";
} else {
  echo "Клиент успешно добавлен";
}

Now, after using this instance, how to remove it from memory? In some functions, an error pops up that there was not enough memory for the script, even if you set it to 3GB via
unset($customer); //не помогает
ini_set('memory_limit', '3076M')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-10-10
@webinar

If 3GB is not enough, then it's definitely not the model, apparently the cycle is endless somewhere.
In general, you can always overwrite a variable:
Why did you even decide that it was in it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question