Tag code

Repository for existing Extbase model class

If you want to use an existing extbase model like Category but want to create a custom repository to implement some custom queries, here is the way to go:

Create typo3conf/ext/your_ext/Classes/Domain/Model/Category.php:

<?php
namespace Dummy\YourExt\Domain\Model;
/**
 * Category
 */
class Category extends \TYPO3\CMS\Extbase\Domain\Model\Category {

}

Create typo3conf/ext/your_ext/Classes/Domain/Repository/CategoryRepository.php:

<?php
namespace Dummy\YourExt\Domain\Repository;
/**
 * The repository for Categories
 */
class CategoryRepository extends \TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository {
    // some custom query methods here
}

Create typo3conf/ext/your_ext/ext_typoscript_setup.txt:

config.tx_extbase{
    persistence{
        classes{
            Dummy\YourExt\Domain\Model\Category {
                mapping {
                    tableName = sys_category
                    recordType = Tx_YourExt_Category
                }
            }
        }
    }
}

Clear the cache and you're ready to go!

Install PyRun on current CentOS

Installing a current version of PyRun on CentOS 6.5 Final did not work for me, several issues occurred:

../bin/pyrun: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory

On current CentOS installations there is no libssl.so.1.0.0, instead after patching the heartbleed bug through yum there is libssl.so.1.0.1e. So simply symlink the lib and you're fine:

ln -s /usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.1.0.0

But afterwards the PyRun installation still does not complete properly - there is another lib failing. Patch it by symlinking again:

../bin/pyrun: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
ln -s /usr/lib64/libcrypto.so.1.0.1e /usr/lib64/libcrypto.so.1.0.0

Now, the whole thing is running.

Automated creation of self signed SSL certificate

For developing websites with SSL on your local computer there is the need to create a self signed SSL certificate. As I often need this, I wrote this little script.

You may adjust the -subj part in line 4:

#!/bin/bash
password="password"
sudo openssl genrsa -passout pass:$password -des3 -out $1.key 1024
sudo openssl req -new -passin pass:$password -subj "/C=DE/ST=Saxony/L=Dresden/CN=$1" -key $1.key -out $1.csr
sudo openssl rsa -passin pass:$password -in $1.key -out $1.key
sudo openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt

Usage:

./create_self_signed_ssl.sh mydomain.local