src/ORM/DataObject.php
public function getReverseAssociation($className)
    {
        if (is_array($this->manyMany())) {
            $many_many = array_flip($this->manyMany());
            if (array_key_exists($className, $many_many)) {
                return $many_many[$className];
            }
        }
        if (is_array($this->hasMany())) {
            $has_many = array_flip($this->hasMany());
            if (array_key_exists($className, $has_many)) {
                return $has_many[$className];
            }
        }
        if (is_array($this->hasOne())) {
            $has_one = array_flip($this->hasOne());
            if (array_key_exists($className, $has_one)) {
                return $has_one[$className];
            }
        }

        return false;
    }
public function getReverseAssociation($className)
    {
        if (is_array($this->manyMany())) {
            $many_many = array_flip($this->manyMany());
            if (array_key_exists($className, $many_many)) {
                return $many_many[$className];
            }
        }
        if (is_array($this->hasMany())) {
            $has_many = array_flip($this->hasMany());
            if (array_key_exists($className, $has_many)) {
                return $has_many[$className];
            }
        }
        if (is_array($this->hasOne())) {
            $has_one = array_flip($this->hasOne());
            if (array_key_exists($className, $has_one)) {
                return $has_one[$className];
            }
        }

        return false;
    }
public function getReverseAssociation ( $ className ) { if ( is_array ( $ this -> manyMany ( ) ) ) { $ many_many = array_flip ( $ this -> manyMany ( ) ) ; if ( array_key_exists ( $ className , $ many_many ) ) { return $ many_many [ $ className ] ; } } if ( is_array ( $ this -> hasMany ( ) ) ) { $ has_many = array_flip ( $ this -> hasMany ( ) ) ; if ( array_key_exists ( $ className , $ has_many ) ) { return $ has_many [ $ className ] ; } } if ( is_array ( $ this -> hasOne ( ) ) ) { $ has_one = array_flip ( $ this -> hasOne ( ) ) ; if ( array_key_exists ( $ className , $ has_one ) ) { return $ has_one [ $ className ] ; } } return false ; }
Temporary hack to return an association name, based on class, to get around the mangle
of having to deal with reverse lookup of relationships to determine autogenerated foreign keys.

@param string $className
@return string
Temporary hack to return an association name based on class to get around the mangle of having to deal with reverse lookup of relationships to determine autogenerated foreign keys .