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 data reset from render due to getting value set from the controller ... #8

Closed
wants to merge 1 commit into from
Closed

Fix data reset from render due to getting value set from the controller ... #8

wants to merge 1 commit into from

Conversation

harikt
Copy link
Member

@harikt harikt commented Jul 1, 2012

As we are already setting the data from controller as

$this->view->setInnerData($data);
$this->data = $some_other_data;

We are missing to merge these both data from the Aura\Framework\Web\AbstractPage::render()

@harikt harikt mentioned this pull request Jul 1, 2012
@ghost ghost assigned pmjones Jul 1, 2012
@@ -217,7 +217,7 @@ protected function render()
$this->view->setFormat($this->getFormat());
if (! $this->response->getContent()) {
// set data
$data = (array) $this->getData();
$data = (array) $this->getData() + (array) $this->view->getInnerData();
$this->view->setInnerData($data);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we want to add the values to setInnerData() in view than resetting it .

@harikt
Copy link
Member Author

harikt commented Jul 4, 2012

@pmjones not a good fix ?

@harikt
Copy link
Member Author

harikt commented Jul 5, 2012

This is a priority fix . I wonder why you didn't merged this . Probably working on a different rendering strategy ?

@harikt
Copy link
Member Author

harikt commented Jul 5, 2012

Also this is related with issue #6 which I closed 4 days back. Have a look into it .

@pmjones
Copy link
Member

pmjones commented Jul 5, 2012

Help me to understand what the point is. What bug does this fix?

@harikt
Copy link
Member Author

harikt commented Jul 5, 2012

@pmjones sure I will try . Have a look into an example https://github.com/harikt/Hari.Blog/blob/master/src/Hari/Blog/Web/Post/Page.php#L19

public function actionAdd()
{
    $stdObject = new \stdclass();
    $stdObject->name = "Hari K T";
    $data = array();
    $data['authors'] = array_fill(0, 10, $stdObject);
    $this->view->setInnerData($data);
    $this->view->setInnerView('add');
}

And now in https://github.com/auraphp/Aura.Framework/blob/master/src/Aura/Framework/Web/AbstractPage.php render() https://github.com/auraphp/Aura.Framework/blob/master/src/Aura/Framework/Web/AbstractPage.php#L215

         $data = (array) $this->getData();
         $this->view->setInnerData($data);

Where getData() is at https://github.com/auraphp/Aura.Web/blob/master/src/Aura/Web/AbstractPage.php#L138

Which is set at constructor https://github.com/auraphp/Aura.Web/blob/master/src/Aura/Web/AbstractPage.php#L93

So the inner_data is not merged.

Or in the action we need to set to $this->data rather than $this->view->setInnerData() . Hope that's clear .

@harikt
Copy link
Member Author

harikt commented Jul 5, 2012

Closing for we don't set data this way .

$this->view->setInnerData($data);

But via

$this->data = $data

@harikt harikt closed this Jul 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants