E.g. in the models there are relations
User HAS_ONE Status and Status BELONGS_TO User
The Tables are:
User:
CREATE TABLE "user" (
"id" VARCHAR NOT NULL ,
"password" VARCHAR NOT NULL ,
"email" VARCHAR NOT NULL ,
"first_name" VARCHAR,
"last_name" VARCHAR,
"status_id" INTEGER,
"group_id" INTEGER,
PRIMARY KEY ("id")
);Status:
CREATE TABLE "status" (
"id" INTEGER NOT NULL,
"name" VARCHAR NOT NULL,
PRIMARY KEY ("id")
);In the controller:
User::model->with( 'status' )->findByPk( $id );
In the view I want to access the $model->status->name instead of the status code. But I get this error:
Trying to get property of non-object
00040: <td><?php echo $user->status->name; ?></td>

Help















