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

    I have a big problem with creating my CMPs... I followed steps in this tutorial (http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution), edited some things that I want to have different... But when i made my build.schema.php and my mysql schema, when i ran build.schema it wrote me "Done.", all classes were created, but thats all... no tables were created in my database :-/

    here is my xml schema:
    <?xml version="1.0" encoding="UTF-8"?> 
    <model package="indications" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">    
        <object class="Indication" table="indications" extends="xPDOSimpleObject"> 
            <field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default=""/> 
            <field key="application_count" dbtype="varchar" precision="255" phptype="string" null="false" default=""/> 
            <field key="application_length" dbtype="varchar" precision="255" phptype="string" null="false" default=""/> 
            <field key="using_addons" dbtype="varchar" precision="255" phptype="string" null="true" default=""/> 
            <field key="application_docs" dbtype="varchar" precision="255" phptype="string" null="false" default=""/> 
            <field key="acupressure_area" dbtype="varchar" precision="255" phptype="string" null="false" default=""/> 
            <field key="indication_type" dbtype="int" precision="10" phptype="string" null="false" default=""/> 
            
            <field key="link" dbtype="int" phptype="integer" null="true" default=""/>
      
            <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/> 
            <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> 
            <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/> 
            <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> 
      
            <aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/> 
            <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/> 
            
            <aggregate alias="Link" class="modResource" local="link" foreign="id" cardinality="one" owner="foreign"/> 
            <aggregate alias="IndicationType" class="IndicationType" local="indication_type" foreign="id" cardinality="one" owner="foreign"/>
        </object> 
        
        <object class="IndicationType" table="indication_types" extends="xPDOSimpleObject"> 
            <field key="name" dbtype="varchar" precision="64" phptype="string" null="false" default=""/> 
            <field key="css_name" dbtype="varchar" precision="64" phptype="string" null="false" default=""/>
     
            <field key="createdon" dbtype="datetime" phptype="datetime" null="true"/> 
            <field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> 
            <field key="editedon" dbtype="datetime" phptype="datetime" null="true"/> 
            <field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" /> 
      
            <aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/> 
            <aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>  
        </object> 
    </model>


    and here is my build.schema.php
    <?php 
    require_once dirname(__FILE__).'/build.config.php'; 
    include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; 
    $modx= new modX(); 
    $modx->initialize('mgr'); 
    $modx->loadClass('transport.modPackageBuilder','',false, true); 
    echo '<pre>'; /* used for nice formatting of log messages */
    $modx->setLogLevel(modX::LOG_LEVEL_INFO); 
    $modx->setLogTarget('ECHO'); 
      
    $root = dirname(dirname(__FILE__)).'/'; 
    
    $sources = array( 
        'model' => $root.'core/components/indications/model/', 
        'schema_file' => $root.'core/components/indications/model/schema/indications.mysql.schema.xml', 
    ); 
    $manager= $modx->getManager(); 
    $generator= $manager->getGenerator(); 
      
    if (!is_dir($sources['model'])) { $modx->log(modX::LOG_LEVEL_ERROR,'Model directory not found!'); die(); } 
    if (!file_exists($sources['schema_file'])) { $modx->log(modX::LOG_LEVEL_ERROR,'Schema file not found!'); die(); } 
    $generator->parseSchema($sources['schema_file'],$sources['model']); 
      
    echo 'Done.'; 
    exit(); 


    and at last my build.config.php
    <?php 
    define('MODX_BASE_PATH', 'D:/Web/www/modx/'); 
    define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); 
    define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); 
    define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); 
    define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); 
      
    define('MODX_BASE_URL','/'); 
    define('MODX_CORE_URL', MODX_BASE_URL . 'core/'); 
    define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/'); 
    define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/'); 
    define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/'); 


    Anyone know where is the problem pls?
      --
      John
      @theboxer
    • This is not intended to create database tables. It just generates the PHP class and map files that represent your xPDO model for working with said tables. You can create them programmatically with the xPDOManager->createObjectContainer() method.
        • 29661
        • 116 Posts
        But in that tutorial I mentioned isn’t anything about creating tables... so I thought that the build.scheme will do it...

        anyway, its done now... don’t know how, but it’s done
          --
          John
          @theboxer