yiisoft / yiisoft/active-record

Map table columns to model properties

Open
#540 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
119
Forks
38
Avg merge
1h 11m
Merged PRs (30d)
1

Description

Proposed new feature or change
CREATE TABLE "user" (
  "id" INT PRIMARY KEY,
  "first_name" VARCHAR NOT NULL,
  "last_name" VARCHAR NOT NULL,
  "created_at" INT NOT NULL,
);
final class User extends ActiveRecord
{
    public int $id;
    #[Column('first_name')]
    public string $firstName;
    #[Column('last_name')]
    public string $lastName;
    #[Column('created_at')]
    public string $createdAt;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ActiveRecord model and the Column attributes shown in the issue, then trace how table columns and model properties are currently associated. Implement the proposed mapping for id, first_name, last_name, and created_at, and verify that the User example reads and writes the corresponding columns correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.