Wednesday, April 4, 2012

Setup

Lets get this thing running, shall we?

I'm installing at http://dixieandtheninjas.net/hellounderscoreworld/


I've got CodeIgniter 2.1.0 downloaded and put it into the new site.

  • CodeIgniter recommends changing the names of your application and system folders for increased security, which I've done, and then updated the index.php file accordingly.
  • I modified CI's config file and updated the base URL. $config['base_url'] = 'http://www.dixieandtheninjas.net/hellounderscoreworld/';
  • I've created a mySQL database just for this blog project, and gone into the database.php file and configured it correctly.

Now we're ready to get Doctrine added.

  • Created a Doctrine.php file in /application/libraries and put the text in from Joel's site.
  • Uploaded the Doctrine folder to /application/libraries/
  • Changed CI's autoload config file
  • Add Models to Doctrine
    Note that this bit is rather tricky.  In the example on Joel’s site, he discusses creating two models, User and Article.  These are actually objects in the code.  He notes that these are different than CI Models and do not extend the CI_Model class.  So I created the mappings directory under /application/models/ and then created an Entities.User.dcm.xml  Now, I’ve done this once before, and so I’m cribbing a little.. my Entities file looks very different than Joel’s.  Here is mine.
<doctrine-mapping>
    <entity name="Entity\User" table="Users" change-tracking-policy="DEFERRED_IMPLICIT">
        <id name="id" type="smallint" column="ID">
            <generator strategy="IDENTITY"/>
        </id>
           
        <field name="name" type="string" column="Name" length="40"/>
                                    
    </entity>
</doctrine-mapping>
           

So, here’s the thing:  I’m just going to come right out and admit that I don’t really understand this Entities file, what it does, how it does it or why.  But I’m doing this to learn, so hopefully at some point I can say that this is no longer the case.

And this is where I get stuck for the moment.  Joel’s page discusses further configuration changes, including a CLI for Doctrine, and setting up Proxies and entity classes.  So I’m going to have to stop here for a bit and study it further.  Based on previous experience, this is a functioning install – in that I can get classes to work, and MVC to do its thing, though I have not yet tested database connectivity – which is of course important.  That’ll be next.  Stay tuned!




    No comments:

    Post a Comment