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

reimplement autom model behaviors #37

Open
schmunk42 opened this issue Jul 31, 2013 · 2 comments
Open

reimplement autom model behaviors #37

schmunk42 opened this issue Jul 31, 2013 · 2 comments

Comments

@schmunk42
Copy link
Owner

from "default/model"....

foreach ($columns as $name => $column) {
            if (in_array($column->name, array(
                'create_time',
                'createtime',
                'created_at',
                'createdat',
                'changed',
                'changed_at',
                'updatetime',
                'update_time',
                'timestamp'))
            ) {
                $behaviors .= sprintf("\n            'CTimestampBehavior' => array(
                'class' => 'zii.behaviors.CTimestampBehavior',
                'createAttribute' => %s,
                'updateAttribute' => %s,
            ),\n", $this->getCreatetimeAttribute($columns),
                    $this->getUpdatetimeAttribute($columns));
                break; // once a column is found, we are done
            }
        }
        foreach ($columns as $name => $column) {
            if (in_array($column->name, array(
                'user_id',
                'userid',
                'ownerid',
                'owner_id',
                'created_by',
                'createdby',
                'create_user'))
            ) {
                $behaviors .= sprintf("\n            'OwnerBehavior' => array(
                'class' => 'OwnerBehavior',
                'ownerColumn' => '%s',
            ),\n", $column->name);
                break; // once a column is found, we are done

            }
        }
schmunk42 added a commit that referenced this issue Jul 31, 2013
@motin
Copy link
Collaborator

motin commented Sep 20, 2013

What was the rationale of removing this? Can we put the code back as it was or how do we reimplement in a better way?

@schmunk42
Copy link
Owner Author

This list will be endless: 'create_time', 'createtime', 'created_at', 'createdat', 'changed', 'changed_at', 'updatetime', 'update_time', 'timestamp' and it's very hard to extend the way it is.

What's about "providers" for this also?

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

No branches or pull requests

2 participants