phramework / jsonapi

jsonapi implementation for phramework
https://phramework.github.io/jsonapi/
Apache License 2.0
4 stars 2 forks source link

Create new class for relationships in ValidationModel #46

Open nohponex opened 8 years ago

nohponex commented 8 years ago

ObjectValidator is overkill when defining relationships in ValidationModel.

Although the generalized ObjectValidator might be useful for custom validators like (permissions check) etc

Perhaps we can keep ObjectValidator as $2 argument of ValidationModel and create the new class as helper method that bootstraps a default ObjectValidator based on it's constructor parameters

<?php
class RelationshipsValidator extends ObjectValidator
{
public function __construct(string[] $relationships, string[] $required)
{
   //use parent::__construct
}
}