public static function initialize(AbstractRepo $repo) { SoftDeleteTrait::initialize($repo); $repo->addAsserts([new Present('name'), new Present('other')])->addEventAfter(Event::CONSTRUCT, function ($model) { $model->afterConstructCalled = true; }); }
public static function initialize(AbstractRepo $repo) { SoftDeleteTrait::initialize($repo); $repo->setFile('User.json')->addRels([new Rel\One('address', $repo, Address::getRepo()), (new Rel\Many('posts', $repo, Post::getRepo()))->setLinkClass(__NAMESPACE__ . '\\LinkManyPosts')])->addAsserts([new Assert\Present('name')])->addSerializers([new Serializer\Json('profile')]); }
public static function initialize(AbstractRepo $repo) { SoftDeleteTrait::initialize($repo); $repo->addRels([new RelOne('one', $repo, Model::getRepo()), new RelMany('many', $repo, Model::getRepo())]); }