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

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

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

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

ovr opened this issue Sep 26, 2013 · 5 comments
Labels
bug A bug report status: medium Medium

Comments

@ovr
Copy link
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.

@phalcon
Copy link
Collaborator

phalcon commented Oct 2, 2013

What is the bug?

@ovr
Copy link
Contributor Author

ovr commented Oct 2, 2013

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

@phalcon
Copy link
Collaborator

phalcon 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?

@ovr
Copy link
Contributor Author

ovr commented Aug 5, 2014

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

@andresgutierrez
Copy link
Sponsor Contributor

Closed as no script to reproduce was provided

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

3 participants