eav icon indicating copy to clipboard operation
eav copied to clipboard

How to use wthCount, withSum and so on

Open smilelanss opened this issue 3 years ago • 2 comments

Hi @sunel $organizations = OrganizationEav::withCount('comments' )->get(); withCount don't work. Is there a solution to this problem?

error SQLSTATE[08P01]: <<Unknown error>>: 7 ERROR: bind message supplies 11 parameters, but prepared statement "pdo_stmt_00000013" requires 13 (SQL: select (select count(*) from "comments" where "organizations"."id" = "comments"."commentable_id" and "comments"."commentable_type" = organization and "status" = PUBLISHED and "parent_id" is null) as "comments_count"

smilelanss avatar Feb 09 '22 10:02 smilelanss

@smilelanss

Can you post the class blueprint here

sunel avatar Feb 10 '22 11:02 sunel

@sunel Class: use App\EavModels\Organization as OrganizationEav;

Model:

use Eav\Model;
class Organization extends Model

smilelanss avatar Feb 14 '22 09:02 smilelanss