1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/Doctrine/Relation.php

114 lines
2.9 KiB
PHP
Raw Normal View History

2006-05-30 12:42:10 +04:00
<?php
/**
* Doctrine_Relation
*
* @package Doctrine ORM
* @url www.phpdoctrine.com
* @license LGPL
*/
class Doctrine_Relation {
/**
* RELATION CONSTANTS
*/
/**
* constant for ONE_TO_ONE and MANY_TO_ONE aggregate relationships
*/
const ONE_AGGREGATE = 0;
/**
* constant for ONE_TO_ONE and MANY_TO_ONE composite relationships
*/
const ONE_COMPOSITE = 1;
/**
* constant for MANY_TO_MANY and ONE_TO_MANY aggregate relationships
*/
const MANY_AGGREGATE = 2;
/**
* constant for MANY_TO_MANY and ONE_TO_MANY composite relationships
*/
const MANY_COMPOSITE = 3;
/**
2006-06-22 00:02:40 +04:00
* @var Doctrine_Table $table foreign factory
2006-05-30 12:42:10 +04:00
*/
private $table;
/**
* @var string $local local field
*/
private $local;
/**
* @var string $foreign foreign field
*/
private $foreign;
/**
* @var integer $type bind type
*/
private $type;
2006-06-25 22:34:53 +04:00
/**
* @var string $alias relation alias
*/
private $alias;
2006-06-22 00:02:40 +04:00
2006-05-30 12:42:10 +04:00
/**
* @param Doctrine_Table $table
* @param string $local
* @param string $foreign
* @param integer $type
2006-06-22 00:02:40 +04:00
* @param string $alias
2006-05-30 12:42:10 +04:00
*/
2006-06-22 00:02:40 +04:00
public function __construct(Doctrine_Table $table, $local, $foreign, $type) {
2006-05-30 12:42:10 +04:00
$this->table = $table;
$this->local = $local;
$this->foreign = $foreign;
$this->type = $type;
}
2006-06-25 22:34:53 +04:00
/**
* @return string the relation alias
*/
public function getAlias() {
return $this->alias;
}
2006-05-30 12:42:10 +04:00
/**
2006-06-22 00:02:40 +04:00
* @return integer the relation type, either 0 or 1
2006-05-30 12:42:10 +04:00
*/
public function getType() {
return $this->type;
}
/**
* @return object Doctrine_Table foreign factory object
*/
public function getTable() {
return $this->table;
}
/**
2006-06-22 00:02:40 +04:00
* @return string the name of the local column
2006-05-30 12:42:10 +04:00
*/
public function getLocal() {
return $this->local;
}
/**
2006-06-22 00:02:40 +04:00
* @return string the name of the foreignkey column where
* the localkey column is pointing at
2006-05-30 12:42:10 +04:00
*/
public function getForeign() {
return $this->foreign;
}
/**
* __toString
*/
public function __toString() {
$r[] = "<pre>";
$r[] = "Class : ".get_class($this);
$r[] = "Component : ".$this->table->getComponentName();
$r[] = "Table : ".$this->table->getTableName();
$r[] = "Local key : ".$this->local;
$r[] = "Foreign key : ".$this->foreign;
$r[] = "Type : ".$this->type;
$r[] = "</pre>";
return implode("\n", $r);
}
}
?>