Closed ivank closed 6 years ago
@ivank: can you post example code? In what situation would you need this feature?
For basic $auth_user from jelly-auth
$user = Jelly::factory('user')->save();
Does not trigger validation error but rather throughs a general exception for the connection with user_tokens table
Database_Exception [ 1064 ]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 [ SELECT `user_tokens`.`id` AS `id`, `user_tokens`.`user_agent` AS `user_agent`, `user_tokens`.`token` AS `token`, `user_tokens`.`type` AS `type`, `user_tokens`.`created` AS `created`, `user_tokens`.`expires` AS `expires`, `user_tokens`.`user_id` AS `user` FROM `user_tokens` AS `user_tokens` WHERE `user_tokens`.`id` IN NULL ]
we've dealt with it for now in Jelly_Core_Field_ManyToMany with
public function get($model, $value)
{
if ($model->changed($this->name))
{
if($value)
return Jelly::query($this->foreign['model'])
->where($this->foreign['field'], 'IN', $value);
else
return $value;
}
But I'm not sure it's the best course of action.
When I do a $model->as_array() on an model that has not yet been created, I get an exception form here
The thing is - value is null so the
>where($this->foreign['field'], 'IN', $value);
fails There should be a empty($value) check here i think.