Hallo,

I've recently stumble about this module and wanted to try this.
But on adopting a table (admin/structure/data/adopt) I'm only getting an empty view, no tables to choose.

Can you help me out?

Thanks in advance.

Cheers,
Matthias

Comments

mfrosch created an issue. See original summary.

alansaviolobo’s picture

StatusFileSize
new1.59 KB

this is just a start to this patch. it lists out all the tables in the db minus those defined in hook_schema.
tables created by Entities still need to be eliminated from the list. and of course the submit action.

joachim’s picture

Looks like a good start!

+++ b/src/Form/TableAdoptForm.php
@@ -24,7 +25,37 @@ class TableAdoptForm extends FormBase {
+    foreach($enabled_modules as $module) {
...
+    } else {

Check coding standards -- else should not be coddled; space after a foreach.

lquessenberry’s picture

Message Error: Call to undefined function Drupal\data\Form\schema_dbobject() in Drupal\data\Form\TableAdoptForm->buildForm() (line 29 of /var/www/drupalvm/drupal/web/modules/contrib/data/src/Form/TableAdoptForm.php) #0 [internal function]: Drupal\data\Form\TableAdoptForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #1 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array) #2 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(271): Drupal\Core\Form\FormBuilder->retrieveForm('table_adopt_for...', Object(Drupal\Core\Form\FormState)) #3 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('table_adopt_for...', Object(Drupal\Core\Form\FormState)) #4 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #5 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #6 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #7 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #8 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #9 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #10 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #11 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #12 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/drupalvm/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/drupalvm/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #21 {main}.

josebc’s picture

Using schema_dbobject will add an additional dependency on schema module wich i think is not the best solution here

joachim’s picture

> Using schema_dbobject will add an additional dependency on schema module wich i think is not the best solution here

How much heavy lifting will if save us if we use Schema module? If the answer is that it saves us quite a lot, I'd be ok to add it as a dependency.

josebc’s picture

Sounds reasonable, Im planning to use Data heavily in an upcoming project so ill try to post patches as much as possible
Couple of questions to get started
Currently the implementation for the adopt() is in src/Table.php (wich still have some d7 code), should we keep it there or move it to the entity class?
Regarding schema dependency, should we keep it as a conditional or move it to .info.yml as a dependency?

Thanx

joachim’s picture

I've not worked on the D8 version of the code, so I don't really know what to answer, sorry.

> Currently the implementation for the adopt() is in src/Table.php (wich still have some d7 code), should we keep it there or move it to the entity class?

Presumably, if you adopt a table, you are creating a new data table config entity to represent it. So I wouldn't put that in the entity class.

Table.php definitely looks like D7 code, as it appears to be a sort of weird object that works with the tables, but is instantiated for a specific table. I would be inclined to add a TableManager service, and gradually move the methods from Table into it, though best do that either before you fix adoption code, or after, rather than at the same time. With a module where the maintainer hasn't worked with the code in a long time, simpler patches will get committed more quickly!

> Regarding schema dependency, should we keep it as a conditional or move it to .info.yml as a dependency?

IIRC Schema is more of a developer module that you wouldn't run on a production server, and Data is something that you would. So that points to it not being a dependency.

josebc’s picture

Assigned: Unassigned » josebc
StatusFileSize
new8.15 KB

Here is a patch to get things rolling

A few notes:

  1. Schema function is throwing some warnings (Ill post an issue there).
  2. Some tables are showing that shouldn't be eg. batch, cache_container ... etc (also related to schema).
  3. New service "TableManager" to eventually replace Table class.
  4. Table class is not really doing anything (constructor is broken because of d7 code), will keep as a reference atm.

Any input is appreciated

rsabbi’s picture

Dears,

I have exactly the empty adopt view problem. Should I apply both patches or only the latest one?

Thanks
RS

se7ent1’s picture

Same problem here.

When I apply patch #2, I see a list of all the orphaned tables (but i can only adopt them, while in the D7 version, I could use them directly in an new entity or in a View).
When I apply patch #9, there is a general error ("The website encountered an unexpected error. Please try again later.)

Core is latest version 8.7.3
Data is dev version
Schema module is installed.

Hopefully someone can give me some clues.

Grtz
Olivier

drakkhis’s picture

Any update on this issue?