CakePHP Cookbook Documentation 5.xCollection::reject() Collection::every() Collection::some() Collection::match() Collection::firstMatch() Aggregation Collection::reduce() Collection::min() Collection::max() Collection::sumOf() Collection::avg() 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($tags)) { // If there are no tags provided, find articles that have must return a modified query object. In our finder we’ve leveraged the distinct() and leftJoin() methods which allow us to find distinct articles that have a ‘matching’ tag. Creating the View Now if you0 码力 | 1080 页 | 939.39 KB | 1 年前3
CakePHP Cookbook Documentation 5.x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 'Articles.published', 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($tags)) { // If there are no tags provided, find articles that have no tags must return a modified query object. In our finder we’ve leveraged the distinct() and leftJoin() methods which allow us to find distinct articles that have a ‘matching’ tag. Creating the View Now if you0 码力 | 848 页 | 2.53 MB | 1 年前3
CakePHP Cookbook 3.x
Locating Themes Loading Vendor Files Collections Quick Example List of Methods Iterating Filtering Aggregation Grouping and Counting Sorting Working with Tree Data Other Methods Withdrawing Elements Expanding columns on the provided table or association instance’s target table. Query::distinct() now accepts a string to distinct on a single column. Table::loadInto() was added. EXTRACT, DATE_ADD and DAYOFWEEK 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($options['tags'])) { // If there are no tags provided, find articles0 码力 | 1244 页 | 1.05 MB | 1 年前3
CakePHP Cookbook 4.x
Collection::reject() Collection::every() Collection::some() Collection::match() Collection::firstMatch() Aggregation Collection::reduce() Collection::min() Collection::max() Collection::sumOf() Collection::avg() 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($options['tags'])) { // If there are no tags provided, find articles must return a modified query object. In our finder we’ve leveraged the distinct() and leftJoin() methods which allow us to find distinct articles that have a ‘matching’ tag. Creating the View Now if you0 码力 | 1249 页 | 1.04 MB | 1 年前3
CakePHP Cookbook 3.x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . columns on the provided table or association instance’s target table. • Query::distinct() now accepts a string to distinct on a single column. • Table::loadInto() was added. • EXTRACT, DATE_ADD and DAYOFWEEK 'Articles.published', 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($options['tags'])) { // If there are no tags provided, find articles that0 码力 | 967 页 | 2.80 MB | 1 年前3
CakePHP Cookbook 4.x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 'Articles.published', 'Articles.created', 'Articles.slug', ]; $query = $query ->select($columns) ->distinct($columns); if (empty($options['tags'])) { // If there are no tags provided, find articles that must return a modified query object. In our finder we’ve leveraged the distinct() and leftJoin() methods which allow us to find distinct articles that have a ‘matching’ tag. Creating the View Now if you0 码力 | 967 页 | 2.88 MB | 1 年前3
CakePHP Cookbook 2.x
conditions 'recursive' => 1, // int // array of field names 'fields' => array('Model.field1', 'DISTINCT Model.field2'), // string or array defining order 'order' => array('Model.created', 'Model ->find('count'); $publishedAuthors = $this->Article->find('count', array( 'fields' => 'DISTINCT Article.user_id', 'conditions' => array('Article.status !=' => 'pending') )); // .. Note Don’t pass fields as an array to find('count'). You would only need to specify fields for a DISTINCT count (since otherwise, the count is always the same, dictated by the conditions). find(‘all’)0 码力 | 1096 页 | 958.62 KB | 1 年前3
CakePHP Cookbook 2.x
of conditions 'recursive' => 1, // int // array of field names 'fields' => array('Model.field1', 'DISTINCT Model.field2'), // string or array defining order 'order' => array('Model.created', 'Model.field3 $this->Article->User->find('count'); $publishedAuthors = $this->Article->find('count', array( 'fields' => 'DISTINCT Article.user_id', 'conditions' => array('Article.status !=' => 'pending') )); // ... } Note: Don’t Don’t pass fields as an array to find('count'). You would only need to specify fields for a DISTINCT count (since otherwise, the count is always the same, dictated by the conditions). 216 Chapter 6. Models0 码力 | 820 页 | 2.52 MB | 1 年前3
共 8 条
- 1













