1

I am saving an entity and I would want to get the node id of that saved entity.

$CustomerEntity = CustomerEntity::create([
        'customer_id' => $customer['id'],
        'customer_name' => $customer['name'],
        'address' => $customer['address'],
  ]);

  $CustomerEntity->save();

How do I get the node id from here?

4

Try $CustomerEntity->id(); after saving your entity.

  • This apparently is empty if trying to get it one line below... when halting using a debug breakpoint and then reading it, it is perfectly filled. – Florian Müller Jun 7 '18 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.