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 "The variable ‚rows‘ already exists" #483

Merged
merged 3 commits into from Mar 3, 2017

Conversation

4 participants
@temistokles
Copy link
Contributor

temistokles commented Mar 2, 2017

No description provided.

@paveljanda

This comment has been minimized.

Copy link
Member

paveljanda commented Mar 2, 2017

Hm, I know. But it is an issue in nette components. :/

@juniwalk Your opinion?

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Mar 3, 2017

@paveljanda Well there is not much of a choice. If there already is any variable this is the only way to overwrite it, as far as I know.

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Mar 3, 2017

That $this->getTemplate() should be refactored into variable. Soooo much calls for no reason what so ever.

$this->getTemplate()->add('filter', $this['filter']);
$this->getTemplate()->filter = $this['filter'];

This comment has been minimized.

@paveljanda

paveljanda Mar 3, 2017

Member

Can you please remove this empty line identation? Thanks.

This comment has been minimized.

@temistokles

temistokles Mar 3, 2017

Author Contributor

There you go :)

@radekdostal

This comment has been minimized.

Copy link
Contributor

radekdostal commented Mar 3, 2017

Alternative form of setting is

$this->getTemplate()->setParameters([
  'variable1' => $value1,
  'variable2' => $value2,
  ...
]);

@paveljanda paveljanda merged commit 0ae83ad into contributte:v5.x Mar 3, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@paveljanda

This comment has been minimized.

Copy link
Member

paveljanda commented Mar 3, 2017

Thanks!

@juniwalk

This comment has been minimized.

Copy link
Collaborator

juniwalk commented Mar 3, 2017

@radekdostal Does it scream with errors if there already is parameter with the same name?

@radekdostal

This comment has been minimized.

Copy link
Contributor

radekdostal commented Mar 3, 2017

@juniwalk I think that add() method throws exception when the variable already exists, but setParameters() allows it to overwrite.

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.