Skip to content

Commit

Permalink
Add MetastazTemplate form generation
Browse files Browse the repository at this point in the history
  • Loading branch information
konandrum committed Aug 11, 2011
1 parent ca605ec commit d5557eb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Metastaz/Stores/DoctrineMetastazStore.php
Expand Up @@ -33,7 +33,7 @@ protected function getEntityManager()
$params = $this->getMetastazContainer()->getParameter('metastaz.store_parameters');
$this->em = MetastazBundle::getContainer()
->get('doctrine')
->getEntityManager($params['connexion_name'])
->getEntityManager($params['connection_name'])
;
}
return $this->em;
Expand Down
Expand Up @@ -3,6 +3,7 @@

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\DependencyInjection\Container;

/**
* MetastazField define a field aggregate by a MetastazTemplate
Expand Down Expand Up @@ -94,7 +95,7 @@ public function getId()
*/
public function setMetaNamespace($metaNamespace)
{
$this->meta_namespace = $metaNamespace;
$this->meta_namespace = Container::camelize(str_replace(' ', '_', $metaNamespace));
}

/**
Expand All @@ -114,7 +115,7 @@ public function getMetaNamespace()
*/
public function setMetaKey($metaKey)
{
$this->meta_key = $metaKey;
$this->meta_key = Container::camelize(str_replace(' ', '_', $metaKey));
}

/**
Expand Down
Expand Up @@ -3,6 +3,7 @@

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\DependencyInjection\Container;

/**
* MetastazTemplate define the metadata fields that can use a metastaz object
Expand Down Expand Up @@ -58,7 +59,7 @@ public function getId()
*/
public function setName($name)
{
$this->name = $name;
$this->name = Container::camelize(str_replace(' ', '_', $name));
}

/**
Expand Down Expand Up @@ -129,4 +130,21 @@ public function hasField($namespace, $key)
}
return false;
}

/**
* Get an array of field types
*
* @return array
*/
public function getFormFields()
{
$ret = array();
foreach($this->getMetastazFields() as $field) {
$ret[] = array(
$field->getMetaNamespace().'_'.$field->getMetaKey(),
$field->getMetastazFieldType()
);
}
return $ret;
}
}
2 changes: 1 addition & 1 deletion src/Metastaz/Bundle/MetastazTemplateBundle/Form/MetastazFieldType.php 100755 → 100644
Expand Up @@ -14,8 +14,8 @@ public function buildForm(FormBuilder $builder, array $options)
->add('meta_key')
->add('is_indexed')
->add('options')
->add('metastaz_field_type')
->add('metastaz_template')
->add('metastaz_field_type')
;
}

Expand Down

0 comments on commit d5557eb

Please sign in to comment.