Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new feature: using model methods for table render with custom formatting. #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants