예제 #1
0
    public function __construct()
    {
        parent::__construct();
        $this->typeAlias['timestamp'] = '\\DateTime';
        $this->typeAlias['serialized'] = 'mixed';
        $this->typeAlias['serializedBinary'] = 'mixed';
        $this->typeAlias['contao-boolean'] = 'bool';
        // @codingStandardsIgnoreStart
        // hack until https://github.com/doctrine/doctrine2/pull/719 is merged
        self::$classTemplate = '<?php

<namespace>

<entityAnnotation>
<entityClassName> implements \\Contao\\Doctrine\\ORM\\EntityInterface
{
<constants>
<entityBody>

	/**
	 * {@inheritdoc}
	 */
	static public function entityTableName()
	{
		return static::TABLE_NAME;
	}

	/**
	 * {@inheritdoc}
	 */
	static public function entityPrimaryKeyNames()
	{
		return explode(\',\', static::PRIMARY_KEY);
	}
}';
        self::$getMethodTemplate = '/**
 * <description>
 *
 * @return <variableType>
 */
public function <methodName>()
{
<spaces>return \\Contao\\Doctrine\\ORM\\EntityHelper::callGetterCallbacks($this, self::TABLE_NAME, \'<variableName>\', $this-><fieldName>);
}';
        self::$setMethodTemplate = '/**
 * <description>
 *
 * @param <variableType>$<variableName>
 * @return <entity>
 */
public function <methodName>(<methodTypeHint>$<variableName><variableDefault>)
{
<spaces>$this-><fieldName> = \\Contao\\Doctrine\\ORM\\EntityHelper::callSetterCallbacks($this, self::TABLE_NAME, \'<variableName>\', <variableCast>$<variableName>);

<spaces>return $this;
}';
        // @codingStandardsIgnoreEnd
    }