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

Fix calling referred column #436

Merged
merged 1 commit into from Dec 24, 2016

Conversation

3 participants
@kubarta
Copy link
Contributor

kubarta commented Dec 23, 2016

There was some bug when I call this:

$grid->addColumnText('sport', 'Sport', 'sport.name');

Then a Nette application throws Nette\MemberAccessException with message Cannot read an undeclared column 'sport.name'.

Nette: 2.4
PHP: 7.0.8-0ubuntu0.16.04.3

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 23, 2016

@Kuba93 Hello, give me more information, what data source are you using?

@kubarta

This comment has been minimized.

Copy link
Contributor Author

kubarta commented Dec 23, 2016

@juniwalk Hi, I'm using Nette\Database\Table

@kubarta

This comment has been minimized.

Copy link
Contributor Author

kubarta commented Dec 23, 2016

There is piece of code where I use a datagrid: https://gist.github.com/Kuba93/567d588dbba9e2778195350c85f80b28

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 23, 2016

@Kuba93 Can you also send me tracy error log? Maybe remove all sensitive parts.

@kubarta

This comment has been minimized.

Copy link
Contributor Author

kubarta commented Dec 23, 2016

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 24, 2016

@Kuba93 I am sorry I opened this from email without thinking. This is PR not an issue so I did not need all those things I wanted from you.

Thanks for the contribution.

@juniwalk juniwalk merged commit 655b5af into contributte:master Dec 24, 2016

2 checks passed

Scrutinizer 1 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 24, 2016

@Kuba93 Just a question, what is the difference between related and reffered table? I am Doctrine guy so I don't use this. Seems duplicated without knowledge of the difference. See https://github.com/ublaboo/datagrid/blob/master/src/Row.php#L95

@paveljanda

This comment has been minimized.

Copy link
Member

paveljanda commented Dec 24, 2016

@juniwalk
Related is just the opposite to referenced. :)

referenced: product_variant.product_id => product.id
related: product.id => product_variant.product_id

As it stands in nette documentation:

$book = $context->table('book')->get(1);
$book->ref('author', 'author_id');
$author = $context->table('author')->get(11);
echo $author->name . " napsal:";

foreach ($author->related('book.author_id') as $book) {
    echo $book->title;
}
@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 24, 2016

@paveljanda Oh I see, so this is alright? I may have merge it little prematurely.

@paveljanda

This comment has been minimized.

Copy link
Member

paveljanda commented Dec 24, 2016

@juniwalk Updated in master, see 34bcd68

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Dec 24, 2016

@paveljanda I just looked at it, nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.