Ejemplo n.º 1
0
 /**
  * Get an array describing the changes.
  *
  * @param UnitOfWork $unitOfWork
  * @param TermOfUse  $entity
  * @param string     $action
  *
  * @return array
  */
 protected function getChangeSet(UnitOfWork $unitOfWork, TermOfUse $entity, $action)
 {
     switch ($action) {
         case 'create':
             return array('id' => array(null, $entity->getId()), 'weight' => array(null, $entity->getWeight()), 'keyCode' => array(null, $entity->getKeyCode()), 'langCode' => array(null, $entity->getLangCode()), 'content' => array(null, $entity->getContent()), 'created' => array(null, $entity->getCreated()), 'updated' => array(null, $entity->getUpdated()));
         case 'update':
             return $unitOfWork->getEntityChangeSet($entity);
         case 'delete':
             return array('id' => array($entity->getId(), null), 'weight' => array($entity->getWeight(), null), 'keyCode' => array($entity->getKeyCode(), null), 'langCode' => array($entity->getLangCode(), null), 'content' => array($entity->getContent(), null), 'created' => array($entity->getCreated(), null), 'updated' => array($entity->getUpdated(), null));
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 private function createTerm($weight, $langCode, $key, $content)
 {
     $term = new TermOfUse();
     $term->setWeight($weight);
     $term->setLangCode($langCode);
     $term->setKeyCode($key);
     $term->setContent($content);
     $this->manager->persist($term);
 }