Hi all
The model "users" hasmany "posts".
The model "posts" belongTo "users".
class Users extends \Phalcon\Mvc\Model{
public $id;
public $name;
---------------
public function initialize(){
$this->hasMany('id', 'Phalconvn\Models\Posts', 'userId', array(
'alias' => 'posts',
'foreignKey' => array(
'message' => 'User cannot be deleted because article has not for '
)
));
}
}
class Posts extends \Phalcon\Mvc\Model{
public $id;
public $userId;
------------
public function initialize(){
$this->belongsTo('userId','Phalconvn\Models\Users','id',array(
'alias' => 'userPost'
));
}
}
When login users with id does not ownership id by posts, but delete post not ownership it is wordking, why is that