1

I have a table token without primary key and when i try to save data, I have an error Maximum function nesting level of '100' reached, aborting!

My TokenModel :

class TokenModel extends Model {
    protected $table = 'token';

    protected $fillable = array('email', 'type', 'check_email');

    protected $primaryKey = null;

    public $incrementing = false;
}

and I try to do this :

    $user = TokenModel::where('email', '=', $email)->first();
    $user->check_email = 'tata';
    $user->update();

and the stack trace :

at Model->mutateAttribute() in Model.php line 2664
at Model->getAttributeValue() in Model.php line 2644
at Model->getAttribute() in Model.php line 2762
at Model->mutateAttribute() in Model.php line 2664
at Model->getAttributeValue() in Model.php line 2644
at Model->getAttribute() in Model.php line 2762
at Model->mutateAttribute() in Model.php line 2664
at Model->getAttributeValue() in Model.php line 2644
at Model->getAttribute() in Model.php line 1739
at Model->getKeyForSaveQuery() in Model.php line 1723
at Model->setKeysForSaveQuery() in Model.php line 1588
at Model->performUpdate() in Model.php line 1507
at Model->save() in Model.php line 1455
at Model->update() in TokenRepository.php line 31

Thanks for your help

Francesco de Guytenaere
  • 4,443
  • 2
  • 25
  • 37
  • 1
    you must have sort of unique column in the table so when you use `update`/`find` it would know what your looking for. – Gal Sisso Jan 19 '16 at 19:46
  • 1
    ps. afaik, `find` also related to delete, get single item, and update. thus without fk, laravel can't do anything but fetch the entire data. however, pagination might still works as it uses offset and limit. – Bagus Tesa Jan 19 '16 at 22:06
  • Why don't you just add a primary key? I bet this will not change anything and I guess you're doing this just to be super extreme. It's a framework if you want everything to work your way just don't use a framework. – Ozan Kurt Jan 19 '16 at 22:59
  • Any update on this post ? Having the same issue and I don't think your data model should change because of laravel's limitations. – thiout_p Sep 27 '16 at 17:02
  • Possible duplicate of [Maximum function nesting level of '100' reached, aborting after upgrading to Laravel 5.1](http://stackoverflow.com/questions/30803342/maximum-function-nesting-level-of-100-reached-aborting-after-upgrading-to-lar) – Abrar Jahin Oct 09 '16 at 05:45

0 Answers0