Mercurial > hg > cmmr2012-drupal-site
comparison modules/contrib/migrate_plus/src/DataParserPluginBase.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
71 */ | 71 */ |
72 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { | 72 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
73 return new static($configuration, $plugin_id, $plugin_definition); | 73 return new static($configuration, $plugin_id, $plugin_definition); |
74 } | 74 } |
75 | 75 |
76 | |
77 /** | 76 /** |
78 * Returns the initialized data fetcher plugin. | 77 * Returns the initialized data fetcher plugin. |
79 * | 78 * |
80 * @return \Drupal\migrate_plus\DataFetcherPluginInterface | 79 * @return \Drupal\migrate_plus\DataFetcherPluginInterface |
81 * The data fetcher plugin. | 80 * The data fetcher plugin. |
109 // At this point, we have a valid open source url, try to fetch a row from | 108 // At this point, we have a valid open source url, try to fetch a row from |
110 // it. | 109 // it. |
111 $this->fetchNextRow(); | 110 $this->fetchNextRow(); |
112 // If there was no valid row there, try the next url (if any). | 111 // If there was no valid row there, try the next url (if any). |
113 if (is_null($this->currentItem)) { | 112 if (is_null($this->currentItem)) { |
114 if ($this->nextSource()) { | 113 while ($this->nextSource()) { |
115 $this->fetchNextRow(); | 114 $this->fetchNextRow(); |
115 if ($this->valid()) { | |
116 break; | |
117 } | |
116 } | 118 } |
117 } | 119 } |
118 if ($this->valid()) { | 120 if ($this->valid()) { |
119 foreach ($this->configuration['ids'] as $id_field_name => $id_info) { | 121 foreach ($this->configuration['ids'] as $id_field_name => $id_info) { |
120 $this->currentId[$id_field_name] = $this->currentItem[$id_field_name]; | 122 $this->currentId[$id_field_name] = $this->currentItem[$id_field_name]; |
123 } | 125 } |
124 | 126 |
125 /** | 127 /** |
126 * Opens the specified URL. | 128 * Opens the specified URL. |
127 * | 129 * |
128 * @param $url | 130 * @param string $url |
129 * URL to open. | 131 * URL to open. |
130 * | 132 * |
131 * @return bool | 133 * @return bool |
132 * TRUE if the URL was successfully opened, FALSE otherwise. | 134 * TRUE if the URL was successfully opened, FALSE otherwise. |
133 */ | 135 */ |
134 abstract protected function openSourceUrl($url); | 136 abstract protected function openSourceUrl($url); |
135 | 137 |
136 /** | 138 /** |
137 * Retrieves the next row of data from the open source URL, populating | 139 * Retrieves the next row of data. populating currentItem. |
138 * currentItem. | 140 * |
141 * Retrieves from the open source URL. | |
139 */ | 142 */ |
140 abstract protected function fetchNextRow(); | 143 abstract protected function fetchNextRow(); |
141 | 144 |
142 /** | 145 /** |
143 * Advances the data parser to the next source url. | 146 * Advances the data parser to the next source url. |