/** * Test transform. * * @param Protection $protection * * @dataProvider dataProvider */ public function testTransform(Protection $protection) { $new = ProtectionEntityTransformer::transform($protection); $this->assertCount($protection->getProtectionuser()->count(), $new); foreach ($protection->getProtectionuser() as $user) { /** @var ProtectionUser $user */ $suche = array_search($user->getUsername(), $this->_collectUsernames($new)); $this->assertInternalType('integer', $suche); } }
/** * Transform protection entity. * * @param Protection $protection * * @return ProtectionModel[] */ public function transformEntity(Protection $protection) { $arr = ProtectionEntityTransformer::transform($protection); foreach ($arr as $model) { try { $password = $this->getCryptservice()->decrypt($model->getPassword()); $model->setPassword($password); } catch (\Exception $e) { } } return $arr; }