I have model:
class Product extends \Phalcon\Mvc\Model{
/**
(...)
*/
public function initialize(){
$this->belongsTo('tax_id', 'Tax', 'tax_id', array(
'foreignKey' => true,
'alias' => 'tax'
));
}
}
class Tax extends \Phalcon\Mvc\Model{
/**
(...)
*/
}
now when i do:
$prod = new Product();
$prod->tax = new Tax();
$this->assertInstanceOf('Tax', $prod->tax); // this passes
$prod->setTax(new Tax());
$this->assertInstanceOf('Tax', $prod->getTax()); // this fails
note that i'm not saving any entities.
What i expect is that both $prod->tax and $prod->getTax() to return same object instance:
$prod = new Product();
$prod->tax = new Tax();
spl_object_hash($prod->tax) == spl_object_hash($prod->getTax())
There should be no diference between using direct property access and setter.
Phalcon v1.3.5