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

Problem with relation two sphinx models ( 1:N ): "syntax error, unexpected QUOTED_STRING, expecting CONST_INT" #36

Closed
shcherbanich opened this issue Jul 16, 2015 · 1 comment
Assignees
Labels
status:to be verified Needs to be reproduced and validated.

Comments

@shcherbanich
Copy link

First model:

class Child extends \yii\sphinx\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function indexName()
    {
        return '{{%child}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id'], 'required'],
            [['id'], 'unique'],
            [['id_parent'], 'integer'],
        ];
    }
}

Second model:

class Parent extends \yii\sphinx\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function indexName()
    {
        return '{{%parent}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id'], 'required'],
            [['id'], 'unique'],
            [['name'], 'string']
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getChilds()
    {
        return $this->hasMany(Child::className(), ['id_parent' => 'id']);
    }
}

Problem:

Parent::find()->with('childs')->all();

PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 sphinxql: syntax error, unexpected QUOTED_STRING, expecting CONST_INT

@klimov-paul klimov-paul added the status:to be verified Needs to be reproduced and validated. label Jul 16, 2015
@klimov-paul klimov-paul self-assigned this Jul 16, 2015
@klimov-paul
Copy link
Member

Unable to reproduce.
Obviously there is a type missmatch between child.id_parent and parent.id.
Most likely it is the same problem as #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests

2 participants