We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17906
    • 18 Posts
    Hi,

    I’m trying to use xPDO for a new ModX project I’m currently working on. I’d like to use to packages: modx for native modx stuff and another one for the new models. I feel xPDO is not really ready for this. I’m using r35 since the latest alpha doesn’t support this but in the loadClass function you only check for the path to the package when there is a package already set ?!
    if (!$ignorePkg && !empty ($this->package)) {
                $fqn= $this->package . '.' . $fqn;
                if (empty ($path) && isset ($this->packages[$this->package]['path'])) {
                    $path= $this->packages[$this->package]['path'];
                }
            }

    What I’d like to be able to do is to use "modx.*" for modx classes and "mypackage.*" for my domain objects...
    Is this possible ? to mix classes from differents packages ?!

    Regards,

    MaDrense
    • You should simply be able to switch packages by calling $xpdo->setPackage(’packagename’, ’root_dir_location’)

      Handling aggregate and composite relations between classes in different packages has not been tested specifically, but there shouldn’t be too many problems using the package switching approach, other than those imposed by PHP (i.e. the classes must have unique names regardless of the package they are in).
        • 17906
        • 18 Posts
        Hi,

        You mean I can perform queries using both packages at the same time ?! I’d like to set the path for the packages and then just not set a default package at all. I’d use "modx.*" for modx classes and "mypackage.*" for my own classes. Is this possible ?

        Regards,

        MaDrense
        • Quote from: MaDrense at Mar 04, 2007, 11:49 PM

          Hi,

          You mean I can perform queries using both packages at the same time ?! I’d like to set the path for the packages and then just not set a default package at all. I’d use "modx.*" for modx classes and "mypackage.*" for my own classes. Is this possible ?

          Regards,

          MaDrense

          Again, you must switch to (i.e. set) a package before calling classes in that package, but you might be able to set a package to represent one step up from your modx and your custom package (if they share the same root path), then reference all of your classes absolutely like modx.ClassName or mypackage.ClassName.