30 protected static function prepareManyToMany($db, &$ret, $instance, $member, $annot =
null) {
31 $class = get_class ( $instance );
32 if (! isset ( $annot )) {
35 if ($annot !==
false) {
36 $key = $annot [
"targetEntity"] .
"|" . $member .
"|" . $annot [
"inversedBy"] .
"|";
37 if (! isset ( $ret [$key] )) {
40 $parser->init ( $annot );
41 $ret [$key] = $parser;
43 $accessor =
"get" . ucfirst ( $ret [$key]->getMyPk () );
44 if (method_exists ( $instance, $accessor )) {
45 $fkv = $instance->$accessor ();
46 $ret [$key]->addValue ( $fkv );
60 $class = get_class ( $instance );
61 if (! isset ( $annot ))
63 if ($annot !==
false) {
64 $fkClass = $annot [
"className"];
66 if ($fkAnnot !==
false) {
67 $fkMemberName = $annot [
"mappedBy"];
68 if (\property_exists ( $fkClass, $fkAnnot [
'name'] )) {
69 $fkMemberName = $fkAnnot [
'name'];
72 $key = $annot [
"className"] .
"|" . $member .
"|" . $fkMemberName .
"|" . $fkAnnot [
"className"];
73 if (! isset ( $ret [$key] )) {
76 $quote = SqlUtils::$quote;
77 $ret [$key]->addPartObject ( $instance, $quote . $fkAnnot [
"name"] . $quote .
"= ?", $fkv );
91 protected static function prepareManyToOne(&$ret, $instance, $value, $fkField, $annotationArray) {
92 $member = $annotationArray [
"member"];
94 $key = $annotationArray [
"className"] .
"|" . $member .
"|" . $fkField .
"|";
95 if (! isset ( $ret [$key] )) {
98 $ret [$key]->addPartObject ( $instance, SqlUtils::$quote . $fk . SqlUtils::$quote .
"= ?", $value );
Object/relational mapping utilities.
static getFirstKeyValue($instance)
static getAnnotationInfoMember($class, $keyAnnotation, $member)
Used by DAO class, prepare relations for loading.
static prepareManyToOne(&$ret, $instance, $value, $fkField, $annotationArray)
Prepares members associated with $instance with a manyToOne type relationship.
static prepareOneToMany(&$ret, $instance, $member, $annot=null)
Prepares members associated with $instance with a oneToMany type relationship.
static prepareManyToMany($db, &$ret, $instance, $member, $annot=null)
Prepares members associated with $instance with a ManyToMany type relationship.
static getFirstKey($class)
Ubiquity\orm\traits This class is part of Ubiquity.