Skip to content

[ActiveRecord] find_all() should accept shorthand params for columns #25

@claudiopro

Description

@claudiopro

Proposal for a shorthand syntax that relieves the caller from building a SQL query fragment. Today you'd do:

$products = $product_factory->find_all(array(
  'where_clause' => '`subcategory_id` = 1 AND `brand_id` = 2'
));

The desired syntax would be instead:

$products = $product_factory->find_all(array(
  'subcategory_id' => 1,
  'brand_id' => 2
));

The assumptions here are:

  • The query always filters down, i.e. the columns are put in AND
  • If the user passes where_clause, all shorthand column params are ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions