55       foreach ($localePrecedence as $locale) {
 
   56          $value =& $this->
getData($key, $locale);
 
   57          if (!empty($value)) 
return $value;
 
   62       $data =& $this->
getData($key, 
null);
 
   65          $locales = array_keys($data);
 
   66          $firstLocale = array_shift($locales);
 
   67          return $data[$firstLocale];
 
   82    public function &
getData($key, $locale = 
null) {
 
   83       if (is_null($locale)) {
 
   84          if (array_key_exists($key, $this->_data)) {
 
   85             return $this->_data[$key];
 
   89          if (array_key_exists($key, $this->_data) && is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key])) {
 
   90             return $this->_data[$key][$locale];
 
  114    public function setData($key, $value, $locale = 
null) {
 
  115       if (is_null($locale)) {
 
  118          if (is_null($value)) {
 
  119             if (array_key_exists($key, $this->_data)) unset($this->_data[$key]);
 
  121             $this->_data[$key] = $value;
 
  125          if (is_null($value)) {
 
  127             if (array_key_exists($key, $this->_data)) {
 
  128                if (is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key])) unset($this->_data[$key][$locale]);
 
  130                if (empty($this->_data[$key])) unset($this->_data[$key]);
 
  133             $this->_data[$key][$locale] = $value;
 
  145    public function unsetData($key, $locale = 
null) {
 
  146       if (is_null($locale)) {
 
  147          unset($this->_data[$key]);
 
  149          unset($this->_data[$key][$locale]);
 
  159    public function hasData($key, $locale = 
null) {
 
  160       if (is_null($locale)) {
 
  161          return array_key_exists($key, $this->_data);
 
  164          return array_key_exists($key, $this->_data) && is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key]);
 
  181       $this->_data =& $data;
 
  188    public function getId() {
 
  196    public function setId($id) {
 
  221    public function upcastTo($targetObject) {
 
  223       $targetObject->setAllData($this->
getAllData());
 
  226       return $targetObject;
 
  238       $this->_hasLoadableAdapters = $hasLoadableAdapters;
 
  256       $metadataSchemaName = $metadataAdapter->getMetadataSchemaName();
 
  257       assert(!empty($metadataSchemaName));
 
  265       $inputType = $metadataAdapter->getInputType();
 
  266       if ($inputType->checkType($this)) {
 
  267          if (!isset($this->_metadataExtractionAdapters[$metadataSchemaName])) {
 
  268             $this->_metadataExtractionAdapters[$metadataSchemaName] = $metadataAdapter;
 
  273       $outputType = $metadataAdapter->getOutputType();
 
  274       if ($outputType->checkType($this)) {
 
  275          if (!isset($this->_metadataInjectionAdapters[$metadataSchemaName])) {
 
  276             $this->_metadataInjectionAdapters[$metadataSchemaName] = $metadataAdapter;
 
  290       if (isset($this->_metadataExtractionAdapters[$metadataSchemaName])) {
 
  291          unset($this->_metadataExtractionAdapters[$metadataSchemaName]);
 
  294       if (isset($this->_metadataInjectionAdapters[$metadataSchemaName])) {
 
  295          unset($this->_metadataInjectionAdapters[$metadataSchemaName]);
 
  311          $loadedAdapters = $filterDao->getObjectsByTypeDescription(
'class::%', 
'metadata::%', $this);
 
  312          foreach($loadedAdapters as $loadedAdapter) {
 
  315          $this->_extractionAdaptersLoaded = 
true;
 
  331          $loadedAdapters = $filterDao->getObjectsByTypeDescription(
'metadata::%', 
'class::%', $this, 
false);
 
  332          foreach($loadedAdapters as $loadedAdapter) {
 
  335          $this->_injectionAdaptersLoaded = 
true;
 
  347       $supportedMetadataSchemas = array();
 
  349       foreach($extractionAdapters as $metadataAdapter) {
 
  350          $supportedMetadataSchemas[] = $metadataAdapter->getMetadataSchema();
 
  352       return $supportedMetadataSchemas;
 
  363       $metadataFieldNames = array();
 
  365       foreach($extractionAdapters as $metadataAdapter) {
 
  367          $metadataFieldNames = array_merge(
 
  369             $metadataAdapter->getDataObjectMetadataFieldNames($translated)
 
  372       return array_unique($metadataFieldNames);
 
  388       $metadataFieldNames = array();
 
  389       foreach($metadataFieldNameCandidates as $metadataFieldNameCandidate) {
 
  390          if($this->
hasData($metadataFieldNameCandidate)) {
 
  391             $metadataFieldNames[] = $metadataFieldNameCandidate;
 
  394       return $metadataFieldNames;
 
  424       $metadataSchemaName = $metadataDescription->getMetadataSchemaName();
 
  426       if(isset($injectionAdapters[$metadataSchemaName])) {
 
  429          $metadataAdapter = $injectionAdapters[$metadataSchemaName]; 
 
  434          $metadataAdapter->setTargetDataObject($this);
 
  438          $dataObject = $metadataAdapter->execute($metadataDescription);
 
  450       $metadataDescription = 
null;
 
  451       $metadataSchemaName = $metadataSchema->getClassName();
 
  453       if(isset($extractionAdapters[$metadataSchemaName])) {
 
  456          $metadataAdapter = $extractionAdapters[$metadataSchemaName];
 
  460          $metadataDescription = $metadataAdapter->execute($this);
 
  462       return $metadataDescription;
 
  469    public function getDAO() {