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

[BUG] \Phalcon\Mvc\Model set property to model on relation #1296

Closed
ovr opened this Issue Sep 26, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@ovr
Contributor

ovr commented Sep 26, 2013

Hi all
i think this bug on https://github.com/phalcon/cphalcon/blob/master/ext/mvc/model.c#L6192
On User Model i have relation Notify like

$this->hasOne('id', 'User\Model\User\Notify', 'user_id', array(
    'foreignKey' => true,
    'alias' => 'Notify'
));

test code

$notify = \User\Model\User\Notify::findFirst(1);
var_dump($notify->toArray());
$notify->adviseToRead = 0; 
var_dump($notify->toArray());

var_dump($user->Notify->toArray());     
$user->Notify->adviseToRead = 0; 
var_dump($user->Notify->toArray());

output

array(14) {
  ["user_id"]=>
  string(1) "1"
  ["message"]=>
  string(1) "1"
  ["commented"]=>
  string(1) "1"
  ["favorite_author"]=>
  string(1) "1"
  ["favorite_product"]=>
  string(1) "1"
  ["my_favorite_author_add_product"]=>
  string(1) "1"
  ["myproduct_add_to_editors_choice"]=>
  string(1) "1"
  ["tarif_expire"]=>
  string(1) "1"
  ["myblog_commented"]=>
  string(1) "1"
  ["mycomment_commented"]=>
  string(1) "1"
  ["news"]=>
  string(1) "1"
  ["feed_report"]=>
  string(1) "1"
  ["adviseToRead"]=>
  string(1) "1"
  ["selectionOfProducts"]=>
  string(1) "1"
}
array(14) {
  ["user_id"]=>
  string(1) "1"
  ["message"]=>
  string(1) "1"
  ["commented"]=>
  string(1) "1"
  ["favorite_author"]=>
  string(1) "1"
  ["favorite_product"]=>
  string(1) "1"
  ["my_favorite_author_add_product"]=>
  string(1) "1"
  ["myproduct_add_to_editors_choice"]=>
  string(1) "1"
  ["tarif_expire"]=>
  string(1) "1"
  ["myblog_commented"]=>
  string(1) "1"
  ["mycomment_commented"]=>
  string(1) "1"
  ["news"]=>
  string(1) "1"
  ["feed_report"]=>
  string(1) "1"
  ["adviseToRead"]=>
  int(0)
  ["selectionOfProducts"]=>
  string(1) "1"
}
array(14) {
  ["user_id"]=>
  string(1) "1"
  ["message"]=>
  string(1) "1"
  ["commented"]=>
  string(1) "1"
  ["favorite_author"]=>
  string(1) "1"
  ["favorite_product"]=>
  string(1) "1"
  ["my_favorite_author_add_product"]=>
  string(1) "1"
  ["myproduct_add_to_editors_choice"]=>
  string(1) "1"
  ["tarif_expire"]=>
  string(1) "1"
  ["myblog_commented"]=>
  string(1) "1"
  ["mycomment_commented"]=>
  string(1) "1"
  ["news"]=>
  string(1) "1"
  ["feed_report"]=>
  string(1) "1"
  ["adviseToRead"]=>
  string(1) "1"
  ["selectionOfProducts"]=>
  string(1) "1"
}
array(14) {
  ["user_id"]=>
  string(1) "1"
  ["message"]=>
  string(1) "1"
  ["commented"]=>
  string(1) "1"
  ["favorite_author"]=>
  string(1) "1"
  ["favorite_product"]=>
  string(1) "1"
  ["my_favorite_author_add_product"]=>
  string(1) "1"
  ["myproduct_add_to_editors_choice"]=>
  string(1) "1"
  ["tarif_expire"]=>
  string(1) "1"
  ["myblog_commented"]=>
  string(1) "1"
  ["mycomment_commented"]=>
  string(1) "1"
  ["news"]=>
  string(1) "1"
  ["feed_report"]=>
  string(1) "1"
  ["adviseToRead"]=>
  string(1) "1"
  ["selectionOfProducts"]=>
  string(1) "1"
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ghost

This comment has been minimized.

Collaborator

ghost commented Oct 2, 2013

What is the bug?

@ovr

This comment has been minimized.

Contributor

ovr commented Oct 2, 2013

@phalcon adviseToRead did`nt change when i update it to 0 on $user->Notify->adviseToRead = 0;

@ghost

This comment has been minimized.

Collaborator

ghost commented Oct 19, 2013

Is property adviceToRead a protected property declared on the Notify model? Could you please submit a full test case with tables and a small script to reproduce the problem?

@niden niden added Unassigned and removed Unassigned labels Apr 3, 2014

@ovr

This comment has been minimized.

Contributor

ovr commented Aug 5, 2014

@phalcon
adviceToRead is public column
I can`t submit full test case

@andresgutierrez

This comment has been minimized.

Member

andresgutierrez commented Aug 28, 2015

Closed as no script to reproduce was provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment