Skip to content
Permalink
Browse files

Adding a couple new functions to Association that will help implement

associations saving
  • Loading branch information...
lorenzo committed Nov 23, 2013
1 parent 6a4dad2 commit ec6e349e7ce221145fb470b9967762120db871af
@@ -437,4 +437,25 @@ public function transformRow($row) {
*/
public abstract function cascadeDelete(Entity $entity, $options = []);
/**
* Returns whether or not the 'source' table is the owning side for this
* association. This means that rows in the 'target' table would miss important
* or required information if the row in 'source' did not exist.
*
* @return boolean
*/
public abstract function isOwningSide();
/**
* Proxies the saving operation for an entity to the target table
*
* @param \Cake\ORM\Entity $entity the data to be saved
* @param array|\ArrayObject $options
* @return boolean|Entity false if $entity could not be saved, otherwise it returns
* the saved entity
* @see Table::save()
*/
public abstract function save(Entity $entity, $options = []);
}
@@ -86,6 +86,16 @@ public function property($name = null) {
return $this->_property;
}
/**
* Returns boolean false, as rows in source table could not exist or would miss
* important information should corresponding row in target table not exist.
*
* @return boolean
*/
public function isOwningSide() {
return false;
}
/**
* Returns a single or multiple conditions to be appended to the generated join
* clause for getting the results on the target table.
@@ -244,6 +244,16 @@ public function cascadeDelete(Entity $entity, $options = []) {
return $table->deleteAll($conditions);
}
/**
* Returns boolean false, as none of the tables 'own' rows in the other side
* of the association
*
* @return boolean
*/
public function isOwningSide() {
return false;
}
/**
* Appends any conditions required to load the relevant set of records in the
* target table query given a filter key and some filtering values.
@@ -92,4 +92,14 @@ public function eagerLoader(array $options) {
return $this->_resultInjector($fetchQuery, $resultMap);
}
/**
* Returns boolean true, as target rows could not exist or would miss information
* should corresponding rows in source association not exist.
*
* @return boolean
*/
public function isOwningSide() {
return true;
}
}
@@ -82,6 +82,16 @@ public function property($name = null) {
return $this->_property;
}
/**
* Returns boolean true, as target rows could not exist or would miss information
* should corresponding rows in source association not exist.
*
* @return boolean
*/
public function isOwningSide() {
return true;
}
/**
* Returns a single or multiple conditions to be appended to the generated join
* clause for getting the results on the target table.

0 comments on commit ec6e349

Please sign in to comment.
You can’t perform that action at this time.