public static function initialize(Config $config) { SoftDeleteTrait::initialize($config); $config->addRels([new Rel\BelongsTo('city', $config, City::getRepo()), new Rel\BelongsTo('country', $config, Country::getRepo()), new Rel\HasOne('purchase', $config, Purchase::getRepo(), ['foreignKey' => 'billingId'])])->addAsserts([new Assert\Present('firstName'), new Assert\Present('lastName'), new Assert\Present('email'), new Assert\Present('phone'), new Assert\Present('postCode'), new Assert\Present('line1'), new Assert\Email('email')]); }
/** * @covers ::initialize */ public function testInitialize() { $repo = City::getRepo(); $this->assertInstanceOf('Harp\\MP\\BelongsTo', $repo->getRel('parent')); $this->assertInstanceOf('Harp\\MP\\HasMany', $repo->getRel('children')); }