Skip to content

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

Closed

Description

@ovr

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.

Activity

  1. ovr commented on Oct 2, 2013

    @ovr
    ContributorAuthor

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

  2. ovr commented on Aug 5, 2014

    @ovr
    ContributorAuthor

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

  3. andresgutierrez commented on Aug 28, 2015

    @andresgutierrez
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions