Feature #55793 » persistence-default-groupings.patch

Default groupings in persistence - Mathias Brodala, 2014-09-02 09:38

View differences:

Classes/TYPO3/Flow/Persistence/Doctrine/Repository.php
40 40
	protected $defaultOrderings = array();
41 41

  
42 42
	/**
43
	 * @var array
44
	 */
45
	protected $defaultGroupings = array();
46

  
47
	/**
43 48
	 * Initializes a new Repository.
44 49
	 *
45 50
	 * @param \Doctrine\Common\Persistence\ObjectManager $entityManager The EntityManager to use.
......
122 127
		if ($this->defaultOrderings) {
123 128
			$query->setOrderings($this->defaultOrderings);
124 129
		}
130
		if ($this->defaultGroupings !== array()) {
131
			$query->setGroupings($this->defaultGroupings);
132
		}
125 133
		return $query;
126 134
	}
127 135

  
......
165 173
	}
166 174

  
167 175
	/**
176
	 * Sets the property names to group results by. Expected like this:
177
	 * array('foo', 'bar')
178
	 *
179
	 * @param array $defaultGroupings The property names to group by by default
180
	 * @return void
181
	 * @api
182
	 */
183
	public function setDefaultGroupings(array $defaultGroupings) {
184
		$this->defaultGroupings = $defaultGroupings;
185
	}
186

  
187
	/**
168 188
	 * Schedules a modified object for persistence.
169 189
	 *
170 190
	 * @param object $object The modified object
Classes/TYPO3/Flow/Persistence/Repository.php
40 40
	protected $defaultOrderings = array();
41 41

  
42 42
	/**
43
	 * @var array
44
	 */
45
	protected $defaultGroupings = array();
46

  
47
	/**
43 48
	 * Initializes a new Repository.
44 49
	 */
45 50
	public function __construct() {
......
128 133
		if ($this->defaultOrderings !== array()) {
129 134
			$query->setOrderings($this->defaultOrderings);
130 135
		}
136
		if ($this->defaultGroupings !== array()) {
137
			$query->setGroupings($this->defaultGroupings);
138
		}
131 139
		return $query;
132 140
	}
133 141

  
......
171 179
	}
172 180

  
173 181
	/**
182
	 * Sets the property names to group results by. Expected like this:
183
	 * array('foo', 'bar')
184
	 *
185
	 * @param array $defaultGroupings The property names to group by by default
186
	 * @return void
187
	 * @api
188
	 */
189
	public function setDefaultGroupings(array $defaultGroupings) {
190
		$this->defaultGroupings = $defaultGroupings;
191
	}
192

  
193
	/**
174 194
	 * Schedules a modified object for persistence.
175 195
	 *
176 196
	 * @param object $object The modified object
Classes/TYPO3/Flow/Persistence/RepositoryInterface.php
109 109
	public function setDefaultOrderings(array $defaultOrderings);
110 110

  
111 111
	/**
112
	 * Sets the property names to group results by. Expected like this:
113
	 * array('foo', 'bar')
114
	 *
115
	 * @param array $defaultGroupings The property names to group by by default
116
	 * @return void
117
	 * @api
118
	 */
119
	public function setDefaultGroupings(array $defaultGroupings);
120

  
121
	/**
112 122
	 * Schedules a modified object for persistence.
113 123
	 *
114 124
	 * @param object $object The modified object
(3-3/3)