Skip to content

Any way to add non database "fields" to fActiveRecord? #209

@ChrissDeGrece

Description

@ChrissDeGrece

Hi,

Suppose I have a table:

PostID int(10)
UserID int(10)

then I do:

fORMJSON::extend();
$post = new Post(1);

echo $post->toJSON();

I would like to add a field to the fActiveRecord that doesn't exist in the table, for example:

$post->addnodbfieldNewField();
$post->setNewField('Some value');
echo $post->toJSON();

Is there any way I can do that and get the new field in the json response?

I have solved my problem by extending my Post class but just want to know if there is a flourish way to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions