Issue #2723553 by kim.pepper, jibran, mattc321: Trigger deprecated warning for ViewsData::get(NULL)
parent
56fd1b600b
commit
9ac5c2b9de
|
@ -82,7 +82,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin
|
|||
$table = $item['table'];
|
||||
$field = $item['field'];
|
||||
// Get the plugin manager for this type.
|
||||
$data = $this->viewsData->get($table);
|
||||
$data = $table ? $this->viewsData->get($table) : $this->viewsData->getAll();
|
||||
|
||||
if (isset($data[$field][$this->handlerType])) {
|
||||
$definition = $data[$field][$this->handlerType];
|
||||
|
|
|
@ -137,12 +137,14 @@ class ViewsData {
|
|||
* removed in 9.0.0. Use getAll() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2723553
|
||||
* @see https://www.drupal.org/node/3090442
|
||||
*
|
||||
* @return array
|
||||
* An array of table data.
|
||||
*/
|
||||
public function get($key = NULL) {
|
||||
if (!$key) {
|
||||
@trigger_error('Calling get() without the $key argument is deprecated in drupal:8.2.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3090442', E_USER_DEPRECATED);
|
||||
return $this->getAll();
|
||||
}
|
||||
if (!isset($this->storage[$key])) {
|
||||
|
@ -297,7 +299,7 @@ class ViewsData {
|
|||
public function fetchBaseTables() {
|
||||
$tables = [];
|
||||
|
||||
foreach ($this->get() as $table => $info) {
|
||||
foreach ($this->getAll() as $table => $info) {
|
||||
if (!empty($info['table']['base'])) {
|
||||
$tables[$table] = [
|
||||
'title' => $info['table']['base']['title'],
|
||||
|
|
|
@ -51,7 +51,7 @@ class ViewsDataHelper {
|
|||
*/
|
||||
public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) {
|
||||
if (!$this->fields) {
|
||||
$data = $this->data->get();
|
||||
$data = $this->data->getAll();
|
||||
// This constructs this ginormous multi dimensional array to
|
||||
// collect the important data about fields. In the end,
|
||||
// the structure looks a bit like this (using nid as an example)
|
||||
|
|
|
@ -52,7 +52,7 @@ class HandlerAllTest extends ViewTestBase {
|
|||
$this->addDefaultCommentField('node', 'article');
|
||||
|
||||
$object_types = array_keys(ViewExecutable::getHandlerTypes());
|
||||
foreach ($this->container->get('views.views_data')->get() as $base_table => $info) {
|
||||
foreach ($this->container->get('views.views_data')->getAll() as $base_table => $info) {
|
||||
if (!isset($info['table']['base'])) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class ViewsDataHelperTest extends UnitTestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$views_data->expects($this->once())
|
||||
->method('get')
|
||||
->method('getAll')
|
||||
->will($this->returnValue($this->viewsData()));
|
||||
|
||||
$data_helper = new ViewsDataHelper($views_data);
|
||||
|
|
|
@ -642,6 +642,9 @@ class ViewsDataTest extends UnitTestCase {
|
|||
* logic.
|
||||
*
|
||||
* @covers ::getAll
|
||||
* @group legacy
|
||||
*
|
||||
* @expectedDeprecation Calling get() without the $key argument is deprecated in drupal:8.2.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3090442
|
||||
*/
|
||||
public function testGetAllEqualsToGetNull() {
|
||||
$expected_views_data = $this->viewsDataWithProvider();
|
||||
|
|
Loading…
Reference in New Issue