tdCorePlugin - 0.1.8

Provides basic functionalities enabling TD CMF.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

tdCorePlugin

The tdCorePlugin is a symfony plugin that provides basic functionalities enabling TD CMF, such as common configuration or random data generation.

This plugin is a part of TD CMF and is based on Doctrine ORM.

Installation

Install the plugin via the subversion repository by executing the following command from the project root directory:

$ svn co http://svn.symfony-project.com/plugins/tdCorePlugin/trunk plugins/tdCorePlugin

or by using the default symfony plugin install command:

$ ./symfony plugin:install -s beta tdCorePlugin

as the actual release is in its beta stage. Run the following command to enable the assets of tdCorePlugin:

$ ./symfony plugin:publish-assets

One of the assets is nice CSS file cooperating with other TD CMF plugins.

Usage

  • This plugin is the main part of the TD CMF and therefore it should be installed as the first one. Other td components will use functionalities provided with tdCorePlugin.

  • Enable the file in your apps/backend/config/view.yml file:

    stylesheets:    [ /tdCorePlugin/css/td_admin.css ]

sfAdminDashPlugin compatibility

The icons provided with the plugin may be used for sfAdminDashPlugin. To do so, you need to do the following:

  • modify the sfAdminDashPlugin/config/app.yml file, set:

    image_dir: /tdCorePlugin/images/icons/
  • and finally you may use the icons in the app.yml file:

    categories:
      Administration:
        items:
          Newsletter:
            url: newsletter
            image: newsletter.png

Random Data Generator

There is a class in the plugin responsible for generating some random data used for the symfony fixtures. During development phase its essential to see how some mechanisms work when real data is available in the database. Writing the same methods many times is useless - that's where random data generator comes in. an example to generate some data in data/fixtures/sample.yml file is shown below:

<?php $generator = new tdRandomDataGenerator(); ?>
Guestbook:
<?php for($i = 0; $i < 150; $i++): ?>
  guestbook_<?php echo $i ?>:
    author: <?php echo $generator->getRandomName()."\n" ?>
    email: <?php echo $generator->getRandomEmail()."\n" ?>
    http: <?php echo $generator->getRandomHttp()."\n" ?>
    text: <?php echo $generator->getRandomText(mt_rand(20,100)*mt_rand(1,5))."\n" ?>
<?php endfor; ?>