setName('media_category'); $this->setPhpName('Category'); $this->setClassname('Trinity\\Bundle\\MediaBundle\\Model\\Category'); $this->setPackage('vendor.trinity.src.Trinity.Bundle.MediaBundle.Model'); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addColumn('label', 'Label', 'VARCHAR', true, 255, null); $this->addForeignKey('category_id', 'CategoryId', 'INTEGER', 'media_category', 'id', false, null, null); $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('slug', 'Slug', 'VARCHAR', false, 255, null); $this->addColumn('tree_left', 'TreeLeft', 'INTEGER', false, null, null); $this->addColumn('tree_right', 'TreeRight', 'INTEGER', false, null, null); $this->addColumn('tree_level', 'TreeLevel', 'INTEGER', false, null, null); // validators } // initialize() /** * Build the RelationMap objects for this table relationships */ public function buildRelations() { $this->addRelation('CategoryRelatedByCategoryId', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), null, 'CASCADE'); $this->addRelation('Media', 'Trinity\\Bundle\\MediaBundle\\Model\\Media', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, null, 'Medias'); $this->addRelation('CategoryRelatedById', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), null, 'CASCADE', 'CategoriesRelatedById'); } // buildRelations() /** * * Gets the list of behaviors registered for this table * * @return array Associative array (name => parameters) of behaviors */ public function getBehaviors() { return array( 'timestampable' => array ( 'create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ), 'sluggable' => array ( 'add_cleanup' => 'true', 'slug_column' => 'slug', 'slug_pattern' => '{Label}', 'replace_pattern' => '/\\W+/', 'replacement' => '-', 'separator' => '-', 'permanent' => 'false', 'scope_column' => '', ), 'nested_set' => array ( 'left_column' => 'tree_left', 'right_column' => 'tree_right', 'level_column' => 'tree_level', 'use_scope' => 'false', 'scope_column' => 'tree_scope', 'method_proxies' => 'false', ), ); } // getBehaviors() } // CategoryTableMap