Skip to content

Conversation

@mzf
Copy link

@mzf mzf commented Feb 3, 2016

For existed issue #7

@mzf
Copy link
Author

mzf commented Feb 4, 2016

Usage example:

            $builder = $this->getDI()->get('modelsManager')
                    ->createBuilder()
                    // если нужны коллбеки, то не использовать!
                    //->columns('id, name, email, status, created_at')
                    ->from('Phalcon\UserPlugin\Models\User\User');

            $columns = [
                'id', 'name', 'email', 'status', ['created_at' => ['tableCreatedAt' => ['d.m.Y H:i']]]
            ];

            $dataTables = new \DataTables\DataTable();
            $dataTables->fromBuilder($builder, $columns)->sendResponse();

In User model

    public function tableCreatedAt($format = 'd.m.Y H:i:s')
    {
        return date($format,  strtotime($this->created_at));
    }

@alimo2
Copy link

alimo2 commented Oct 19, 2016

Is this work with fromResultSet() too ?

I don't think so!

@alimo2
Copy link

alimo2 commented Oct 19, 2016

@mzf i test it but i can't get anything! It dosn't work!

@mzf
Copy link
Author

mzf commented Oct 20, 2016

@alimo2 work only with builder

@alimo2
Copy link

alimo2 commented Oct 22, 2016

@mzf if we have a join & custom format method is in joint table model, what should i do ?

when using Join, columns are not selected in result!

@alimo2
Copy link

alimo2 commented Oct 22, 2016

Would you please fix this

@alimo2
Copy link

alimo2 commented Oct 22, 2016

I think the problem is with join itself!
when using join but dont mention columns, few of them are in result but not all!

using * in columns don't work either!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants