Here is what I have in my app/config/config.yml :

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   %database_driver%
                host:     %database_host%
                dbname:   %database_name%
                user:     %database_user%
                password: %database_password%

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        default_entity_manager: default
        entity_managers:
            default:
                mappings:
                    StofDoctrineExtensionsBundle: ~
                    MyBundle: ~

stof_doctrine_extensions:
    #default_locale: en_US
    orm:
        default: ~

And here is what I have in my Entity file named *GroupPageEngine.php*

namespace My\MyBundle\Entity;

/**
 * @orm:gedmo:Tree(type="nested")
 * @orm:Table(name="GroupPageEngines")
 *
@orm:Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
 */
Class GroupPageEngine {

    /**
     * @orm:Id
     * @orm:Column(type="integer")
     * @orm:GeneratedValue(strategy="AUTO")
     */
private $id;
 /**
     * @orm:Column(type="string", length="255")
     */
private $internal_name;

/**
 * @orm:gedmo:TreeLeft
     * @orm:Column(name="lft", type="integer")
     */
    private $lft;
 /**
     * @orm:gedmo:TreeLevel
     * @orm:Column(name="lvl", type="integer")
     */
    private $lvl;

    /**
     * @orm:gedmo:TreeRight
     * @orm:Column(name="rgt", type="integer")
     */
    private $rgt;
 /**
     * @orm:gedmo:TreeRoot
     * @orm:Column(name="root", type="integer")
     */
    private $root;

    /**
     * @orm:gedmo:TreeParent
     * @orm:ManyToOne(targetEntity="GroupPageEngine", inversedBy="children")
     */
    private $parent;

    /**
     * @orm:OneToMany(targetEntity="GroupPageEngine", mappedBy="parent")
     * @orm:OrderBy({"lft" = "ASC"})
     */
    private $children;

public function getId() { return $this->id; }

public function setParent(GroupPageEngine $parent)    { $this->parent =
$parent; }
    public function getParent()    { return $this->parent; }
    public function getInternalName() { return $this->internal_name; }
    public function setInternalName($internal_name) { $this->internal_name =
$internal_name; }
    public function __toString() { return $this->internal_name; }

I also have more fields that are similar to internal_name which I didn't
post here .


On Thu, Apr 7, 2011 at 7:11 PM, Christophe COEVOET <s...@notk.org> wrote:

>  Le 07/04/2011 18:01, seven seven a écrit :
>
> Here is the code I am using in my controller to insert the data :
>
>  $group = new GroupPageEngine();
>         $group->setInternalName('HomePage');
>  $group->setTitle('HomePageT');
>        $em = $this->get('doctrine.orm.entity_manager');
>         $em->persist($group);
>         $em->flush();
>  Anything wrong here ?
>
>  did you activate the Tree extension in your config ? and did you mapped
> the lft field with the good mapping ?
>
> --
> Christophe | Stof
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
<br>
Cezar

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to