Mongodb support - mongodb doesn't use id.
Closed this issue · 6 comments
This line https://github.com/krafthaus/bauhaus/blob/master/src/KraftHaus/Bauhaus/Builder/FormBuilder.php#L133 causes issues with mongodb.
Mongo DB doesn't use id
but uses _id
.
id
probably shouldn't be hard coded anyways. I've seen lots of databases that use other things like pid (product id), nid (node id), tid (tag id).
Does this work with the new update?
Yes and no. It works only if I make changes that I didn't think would be required.
I get an error if my $mapper->hasMany('diquoterequests')
doesn't match my model name. See: https://gist.github.com/that0n3guy/151fc54f7e0db8893ab7
If I change the above to non-plurl (like my model) like: $mapper->hasMany('diquoterequest')
AND change my public function to non-plurl (public function diquoterequest()
)... then it works.
So I think you've fixed the mongodb bug, but added another bug.
The way it worked before was: http://screencast.com/t/yONewgFae
It does not work that way anymore.
I've made a couple of changes some days ago, can you let me know if this changes things?
Nope... does not. I still have the issues I posted previously where the $mapper->belongsTo('contacts')
and public function contacts()
has to match the model name.
I tested this on a belongsTo in a list. Got this error:
ErrorException (E_UNKNOWN)
Trying to get property of non-object (View: C:\xamppPHP5.4\htdocs\diqc-laravel\vendor\krafthaus\bauhaus\src\views\models\index.blade.php)
Open: C:\xamppPHP5.4\htdocs\diqc-laravel\vendor\krafthaus\bauhaus\src\KraftHaus\Bauhaus\Field\BelongsToField.php
if ($this->getDisplayField() === null) {
throw new \InvalidArgumentException(sprintf('Please provide a display field for the `%s` relation via the display(); method.', $this->getName()));
}
switch ($this->getContext()) {
case BaseField::CONTEXT_LIST:
$value = $this->getValue();
return $value->{$this->getDisplayField()};
break;
I realized I didn't test this on a form... so I just did and it works! So its just an issue w/ lists