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

I got problem with DataStorage #27

Open
phamngocson1988 opened this issue Dec 14, 2018 · 6 comments
Open

I got problem with DataStorage #27

phamngocson1988 opened this issue Dec 14, 2018 · 6 comments

Comments

@phamngocson1988
Copy link

When I use this command, I got error:
$cart->add($item);
The problem is from DatabaseStorage::save() in this line
REPLACE {{{$this->table}}}
SET
{{{$this->dataField}}} = :val,
{{{$this->idField}}} = :id
The property $table you declare above is already in correct syntax ({{%cart}}), no need to add more double-curly braces

@kocheskid
Copy link

Thank you !!!!!!

@justyork
Copy link

justyork commented Jan 8, 2019

Yes, the same. Thanks. What the best way to fix it?

@phamngocson1988
Copy link
Author

I hope Yii2mod update this plugin for everyone can update to their projects.

@ihorchepurnyi
Copy link
Contributor

Hi, can you create PR for this issue? I'm sorry, I don't have enough time

@ihorchepurnyi
Copy link
Contributor

@phamngocson1988 As I understand, we need to change the following code

$command->setSql("
                REPLACE {{{$this->table}}}
                SET
                    {{{$this->dataField}}} = :val,
                    {{{$this->idField}}} = :id
            ")->bindValues([
                ':id' => $identifier,
                ':val' => $sessionData,
            ]);

to this one

$command->setSql("
                REPLACE {$this->table}
                SET
                    {{{$this->dataField}}} = :val,
                    {{{$this->idField}}} = :id
            ")->bindValues([
                ':id' => $identifier,
                ':val' => $sessionData,
            ]);

Right?

@justyork
Copy link

justyork commented Jan 8, 2019

Yes, it solved the problem for me

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

4 participants