Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify custom CRUD relations? #20

Open
rapgithub opened this issue Sep 1, 2018 · 2 comments
Open

Allow to specify custom CRUD relations? #20

rapgithub opened this issue Sep 1, 2018 · 2 comments
Assignees
Labels

Comments

@rapgithub
Copy link

Is it possible to mantain the relation between tables that are in relation?

Cities -> has many themes,
and
each themes -> has many hotels

I will like CRUD shows not only that cities has many themes

but I want to be able to click on the theme name once it is created and when clicked takes me to the Hotels list...

I tried to create a relation like that with CRUD but I get this error:

atk4\ui\Exception: Unable to set property for the object

Any way to do this ?

my code:

$crud = $app->add([
    '\atk4\mastercrud\MasterCRUD',
    'quickSearch'=>['city'],
    'ipp'=>5,
    'fieldsRead'=>['city']
]);

$m = $crud->setModel(new Cities($app->db),
[
  'Themes'=>[
    'CRUD', 'quickSearch'=>false, 'canDelete'=>true, 'canUpdate'=>true',
    'Hotels'=>[
      'CRUD', 'quickSearch'=>false, 'canDelete'=>true, 'canUpdate'=>true'
    ]
  ], 
]);

any ideas?

thanks

@DarkSide666
Copy link
Member

With latest changes in MasterCrud you should be able to do like this. See _crud key - that's how you can pass properties to sub-cruds.

There is also key _tabs. That's how you can pass some properties to tabs view if needed.

$crud = $app->add([
    '\atk4\mastercrud\MasterCRUD',
]);

$m = $crud->setModel(new Cities($app->db),
[
    '_crud' => ['quickSearch'=>['city'], 'ipp'=>5, 'fieldsRead'=>['city']], // for Cities
    'Themes'=>[
        '_crud' => ['quickSearch'=>false, 'canDelete'=>true, 'canUpdate'=>true], // for Themes
        'Hotels'=>[
            '_crud' => ['quickSearch'=>false, 'canDelete'=>true, 'canUpdate'=>true], // for Hotels
        ]
    ], 
]);

Please check if this works for you and if it does (or doesn't not) let us know by replying here.

@DarkSide666 DarkSide666 self-assigned this Oct 8, 2018
@rapgithub
Copy link
Author

thanks I will check it sorry I miss this message I do not know why I did it see it before :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants