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

exception while saving Meta Data #24

Closed
Rahulyadav97 opened this issue Jun 24, 2021 · 4 comments
Closed

exception while saving Meta Data #24

Rahulyadav97 opened this issue Jun 24, 2021 · 4 comments
Labels
invalid This doesn't seem right

Comments

@Rahulyadav97
Copy link

Rahulyadav97 commented Jun 24, 2021

whenever I am creating/updating any meta data with

$order:find(1)
$order->saveField($field,$value);

It is Throwing Exception with Error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'po_number' in 'field list' (SQL: update wp_posts set post_modified_gmt = 2021-06-24 12:28:16, po_number = trweerter, wp_posts.post_modified = 2021-06-24 12:28:16 where ID = 5410);

I think it is because it is trying to update order dates in WP_POST with that field value also.

@Dartui
Copy link
Collaborator

Dartui commented Jun 24, 2021

Hello!

Are you sure that this method is generating error? saveField calls meta relation in model, so it should not try to modify wp_posts table:

https://github.com/corcel/corcel/blob/c3ff0312ef21f7be38c2351c37dc7a296fe5d0f3/src/Concerns/MetaFields.php#L123-L126

Could you please submit part of code from you application which generates this error?

@Dartui Dartui added the needs feedback This needs feedback from issuer label Jun 24, 2021
@Rahulyadav97
Copy link
Author

it was bcz i save method call in my code which was call
$order->filedname = $value;
$order->save() ;

thanks for your prompt response.
I am using this library with zf3.

@Rahulyadav97
Copy link
Author

Rahulyadav97 commented Jun 28, 2021

can you suggest me best function to delete a post like product or order with deleting all records associated with this, like meta data,
And create order.

Thanks.

@Dartui
Copy link
Collaborator

Dartui commented Jul 15, 2021

I have no idea how this package works with ZF3. In Laravel application you could make something like this:

$product = Product::find(1);
$product->meta()->delete();

This part of code will delete all product meta. To create e.g. product, take a look on this comment: #7 (comment). Creating order works in similar way.

I will close this issue for now, if you have any more question feel free to write here.

@Dartui Dartui closed this as completed Jul 15, 2021
@Dartui Dartui added invalid This doesn't seem right and removed needs feedback This needs feedback from issuer labels Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants