Permalink
Browse files

removed hack for generating temporal accessor comment

  • Loading branch information...
1 parent e1f9f06 commit b54bdbf0ebe8183cced1cd8b9b22d925890e368b @mpscholten committed Oct 10, 2013
@@ -381,50 +381,6 @@ protected function addColumnAttributeUnserializedDeclaration(&$script, Column $c
";
}
- /**
- * Adds the comment for a temporal accessor.
- *
- * @param string &$script
- * @param Column $column
- */
- public function addTemporalAccessorComment(Column $column)
- {
- $script = '';
- $clo = $column->getLowercasedName();
-
- $dateTimeClass = $this->getBuildProperty('dateTimeClass');
- if (!$dateTimeClass) {
- $dateTimeClass = '\DateTime';
- }
-
- $handleMysqlDate = false;
- if ($this->getPlatform() instanceof MysqlPlatform) {
- if ($column->getType() === PropelTypes::TIMESTAMP) {
- $handleMysqlDate = true;
- $mysqlInvalidDateString = '0000-00-00 00:00:00';
- } elseif ($column->getType() === PropelTypes::DATE) {
- $handleMysqlDate = true;
- $mysqlInvalidDateString = '0000-00-00';
- }
- // 00:00:00 is a valid time, so no need to check for that.
- }
-
- $script .= "
- /**
- * Get the [optionally formatted] temporal [$clo] column value.
- * {$column->getDescription()}
- *
- * @param string \$format The date/time format string (either date()-style or strftime()-style).
- * If format is NULL, then the raw \DateTime object will be returned.
- *
- * @return mixed Formatted date/time value as string or $dateTimeClass object (if format is NULL), NULL if column is NULL" .($handleMysqlDate ? ', and 0 if column value is ' . $mysqlInvalidDateString : '')."
- *
- * @throws PropelException - if unable to parse/validate the date/time value.
- */";
-
- return $script;
- }
-
/**
* Adds a tester method for an array column.
@@ -10,7 +10,17 @@
{% embed 'Object/_accessor/_baseAccessor.php.twig' with {'builder': builder, 'column': column} %}
{% block comment %}
- {{ builder.addTemporalAccessorComment(column) }} {# todo: remove this ugly hack #}
+ /**
+ * Get the [optionally formatted] temporal [{{ column.name|lower }}] column value.
+ * {{ column.description }}
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or {{ builder.buildProperty('dateTimeClass')|default('\DateTime') }} object (if format is NULL), NULL if column is NULL{% if builder.invalidTemporalString(column) is not null %}, and 0 if column value is {{ builder.invalidTemporalString(column) }}){% endif %}.
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
{% endblock %}
{% block parameters %}
{% set parameters = [{'name': 'format', 'default': defaultFormat|varExport, 'type': null}] %}

0 comments on commit b54bdbf

Please sign in to comment.