smirik / taggable-bundle
Taggable bundle for symfony based on taggable behavior
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 551
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 2
Type:symfony-bundle
Requires
- smirik/propel-taggable-behavior: *
- symfony/symfony: >=2.1,<3.0
This package is not auto-updated.
Last update: 2021-07-09 21:42:03 UTC
README
A behavior and a widget for symfony 2.1 and propel 1.6
How to install
- Add to composer.json
{ "require": { "smirik/propel-taggable-behavior": "*", "smirik/taggable-bundle": "*" } }
- enable the plugin in your AppKernel class
app/AppKernel.php
class AppKernel extends AppKernel { public function registerBundles() { $bundles = array( ... new Smirik\TaggableBundle\SmirikTaggableBundle(), ... ); } }
- add the taggable behavior to propel.ini or config.yml (build properties)
config/schema.xml
<table name="articles" phpName="Article"> <behavior name="taggable" /> <column name="id" type="integer" primaryKey="true" autoIncrement="true"/> <column name="title" type="varchar" size="255" /> <!-- ... --> </table>
- rebuild your model
php app/console propel:build
- As widget in forms
namespace Acme\GalleryBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; class GalleryType extends AbstractType { public function getDefaultOptions(array $options) { return array( 'data_class' => 'Glorpen\GalleryBundle\Model\Gallery', ); } public function buildForm(FormBuilder $builder, array $options) { $builder->add('title', 'text', array('label'=>'Title')); $builder->add('tags', 'tags', array('label' => 'Tags', 'defaultText'=>'add tag', 'class' => 'YOUR_TAG_CLASS_WITH_NAMESPACE')); } public function getName(){ return 'gallery'; } }