New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EntityContext creates not valid children entities if parent has no children #5190
Comments
This features has a very high chance of being removed, once the validation code is reworked. This might influence our decision in what to do about this issue. |
One solution that should work here is that instead of the base entity class being used by |
same problem here. |
The reason it prefers request data is that there can be situations where request data does not get added into the entity. If I'm understanding you correctly the lookup order should be:
|
When an association is undefined return a concrete entity class. This is necessary as notEmpty/allowEmpty callbacks could reference the entity provider. Refs #5190
@saraer How would I reproduce the issue you're running into. I'm not sure I fully understand it. |
@markstory My problem was cleared by not using method in view. I think my problem is caused by my own coding way. |
Ok. I'll close this issue for now, and we can discuss further when a new issue comes up 😄 |
I have Offer table associated to Customers with relation belongsToMany() (codes below are simplified for better reability):
In CustomersTable.php:
I have add() controller action:
And view:
Now, I can't display view, because I have unknown method error (isCompany() method not found). In CustomersTable in validation callback in
$context['providers']['entity']
is storedCake\ORM\Entity
object, instead ofApp\Model\Entity\Customer
.In EntityContext.php method
_getEntity($path)
creates an entity by simplenew Entity()
.But if in POST data
$this->request->data
I have something like:in
$context['providers']['entity']
is storedApp\Model\Entity\Customer
object.The text was updated successfully, but these errors were encountered: