/** * @param TermInterface $entity * @param array $data * @return TermInterface * * @see AbstractFixture::populateEntity() */ protected function populateEntity($entity, array $data) { // `term_id`,`title`,`parent_term_id`, `description`, `vocabulary_id`, `active` $entity->setId($data[0]); $entity->setTitle($data[1]); if (!empty($data[2])) { $entity->setParent($this->getReference($this->getKey() . $data[2])); } $entity->setDescription($data[3]); $entity->setVocabulary($this->getReference('vocabulary' . $data[4])); $entity->setActive((bool) $data[5]); return $entity; }
/** * @param array $data * @param TermInterface $entity */ protected function assertDataEquals(array $data, $entity) { // `term_id`,`title`,`term_parent_id`, `description`, `vocabulary_id`, `active` $this->assertEquals($data[0], $entity->getId()); $this->assertEquals($data[1], $entity->getTitle()); if (empty($data[2])) { $this->assertNull($entity->getParent()); } else { $this->assertEquals($data[2], $entity->getParent()->getId()); } $this->assertEquals($data[3], $entity->getDescription()); $this->assertEquals($data[4], $entity->getVocabulary()->getId()); $this->assertEquals((bool) $data[4], $entity->isActive()); }