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

Trying to loadEavAttributes on empty owner model returns corrupteed SQL #10

Open
alexglue opened this issue Feb 20, 2015 · 0 comments
Open

Comments

@alexglue
Copy link

Action for create an object::view

    <?php
    if(!$model->isNewRecord) $model->getEavAttributes();
    foreach (['attr1', 'attr2', 'attr3'] as $name){?>
        <?= $form->textAreaGroup($model,'eavAttributes['.$name.']', array('widgetOptions'=>array(
            'htmlOptions'=>array('rows'=>6, 'cols'=>50)
        ))); ?>
    <?}?>

calling this:

    public function loadEavAttributes($attributes)

and now we have smth like this on empty object primary key (new entity adding):

SELECT * FROM `project_eav` `t` WHERE (object_id = ) AND (attribute IN (:ycp0, :ycp1, :ycp2))

The solution is to fix EEavBehavior:

    public function loadEavAttributes($attributes) {
        if(is_null($this->getModelId())){ //[+]
            return $this->getOwner(); //[+]
        } //[+]
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

1 participant