Skip to content

Latte and single record problem #31

@ponasromas

Description

@ponasromas

So, I have something like this:

        $r = $this->app->record('users_2fa');
        $list = $r->eq('user_id', 0)->find()->toArray();

That $list values in latte template can be accessed like {$list['user_id']} . But, if I want to make it {$list.user_id} I must do this abomination:

$r = $this->app->record('users_2fa');
$data = $r->eq('user_id', 0)->find()->toArray();
$list = new \ArrayObject($data, \ArrayObject::ARRAY_AS_PROPS);

Now {$list.user_id} works.

It would immensely helpful to have something like this:

        $r = $this->app->record('users_2fa');
        $list = $r->eq('user_id', 0)->find()->toObject();

P.S. Or just like I have mutilated F3:

        $r = $this->app->record('users_2fa');
        $list = $r->eq('user_id', 0)->find()->cast(); // if 'true' passed then it makes objects, otherwise - arrays

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