Skip to content

Entity returns null when used on the model #2838

Description

@Try-Parser

When i extends the class with Entity it returns null when used in model query as returnType also when use in insert it insert null values but when i removed the CodeIgniter\Entity class from the Entity class it will display a good object is there any reason why this is happening ? i really appreciate any kind of help thanks.

object(App\Entities\User)#66 (16) {
  ["id"]=>
  NULL
  ["email"]=>
  NULL
  ["username"]=>
  NULL
  ["password":protected]=>
  NULL
  ["created_by"]=>
  NULL
  ["deleted"]=>
  bool(false)
  ["disabled"]=>
  bool(false)
  ["role"]=>
  NULL
  ["created_at"]=>
  NULL
  ["updated_at"]=>
  NULL
  ["datamap":protected]=>
  array(0) {
  }
  ["dates":protected]=>
  array(3) {
    [0]=>
    string(10) "created_at"
    [1]=>
    string(10) "updated_at"
    [2]=>
    string(10) "deleted_at"
  }
  ["casts":protected]=>
  array(0) {
  }
  ["attributes":protected]=>
  array(10) {
    ["id"]=>
    string(1) "1"
    ["email"]=>
    string(14) "test@gmail.com"
    ["username"]=>
    string(4) "test"
    ["password"]=>
    string(60) "$2y$10$kDCaVVL2DpumXrRcV4pKqO2QjAqIl8g6NtVoPdRoFIKVGRFS9n3VK"
    ["created_at"]=>
    string(19) "2020-04-17 16:55:48"
    ["created_by"]=>
    string(1) "1"
    ["deleted"]=>
    string(1) "0"
    ["disabled"]=>
    string(1) "0"
    ["role"]=>
    string(10) "ADMIN,USER"
    ["updated_at"]=>
    string(19) "2020-04-17 16:55:48"
  }
  ["original":protected]=>
  array(10) {
    ["id"]=>
    string(1) "1"
    ["email"]=>
    string(14) "test@gmail.com"
    ["username"]=>
    string(4) "test"
    ["password"]=>
    string(60) "$2y$10$kDCaVVL2DpumXrRcV4pKqO2QjAqIl8g6NtVoPdRoFIKVGRFS9n3VK"
    ["created_at"]=>
    string(19) "2020-04-17 16:55:48"
    ["created_by"]=>
    string(1) "1"
    ["deleted"]=>
    string(1) "0"
    ["disabled"]=>
    string(1) "0"
    ["role"]=>
    string(10) "ADMIN,USER"
    ["updated_at"]=>
    string(19) "2020-04-17 16:55:48"
  }
  ["_cast":"CodeIgniter\Entity":private]=>
  bool(true)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions