/** * Checks all attributes contained if they contain * the persistence-tag to be persisted. * * Adds those attributes to the persistenceInformation - Container. */ private function _checkAttributes() { $attributes = $this->class->getProperties(); if (!empty($attributes)) { foreach ($attributes as $attribute) { //Iterate over all attributes /* @var $attribute Zend_CodeGenerator_Php_Property */ $docblock = $attribute->getDocblock(); if ($docblock) { $tags = $docblock->getTags(); //Check if a "Column"-Tag is set foreach ($tags as $tag) { /* @var $tag Zend_CodeGenerator_Php_Docblock_Tag */ if ($tag->getName() === self::$tagColumn) { //Column Tag found $this->persistenceInformation->addAttributeToPersist($attribute); } if ($tag->getName() === self::$tagSerial) { //Column Tag found $this->persistenceInformation->addSerialAttribute($attribute); } if ($tag->getName() === self::$tagPkey) { //Pkey Tag found $this->persistenceInformation->addPkeyAttribute($attribute); } } } } } }
/** * @return array */ protected function _provideSqlColumnConstants() { $result = array(); $tableName = $this->getPersistenceInformation()->getTableName(); $tableNameUpper = strtoupper($tableName); $attributesToPersist = $this->getPersistenceInformation()->getAttributesToPersist(); if (!empty($attributesToPersist)) { foreach ($attributesToPersist as $attribute) { /* @var $attribute Zend_CodeGenerator_Php_Property */ $columnName = strtoupper(Model_ClassGenerator_PersistenceInformation::toColumnName($attribute)); $result[$this->_provideColumnConstant($attribute)] = $attribute; } } return $result; }