| @@ 18-36 (lines=19) @@ | ||
| 15 | * @param string $member Member on which a ManyToMany annotation must be present |
|
| 16 | * @param array $annot used internally |
|
| 17 | */ |
|
| 18 | protected static function prepareManyToMany(&$ret,$instance, $member, $annot=null) { |
|
| 19 | $class=get_class($instance); |
|
| 20 | if (!isset($annot)){ |
|
| 21 | $annot=OrmUtils::getAnnotationInfoMember($class, "#ManyToMany", $member); |
|
| 22 | } |
|
| 23 | if ($annot !== false) { |
|
| 24 | $key=$annot["targetEntity"]."|".$member."|".$annot["inversedBy"]; |
|
| 25 | if(!isset($ret[$key])){ |
|
| 26 | $parser=new ManyToManyParser($instance, $member); |
|
| 27 | $parser->init($annot); |
|
| 28 | $ret[$key]=$parser; |
|
| 29 | } |
|
| 30 | $accessor="get" . ucfirst($ret[$key]->getMyPk()); |
|
| 31 | if(method_exists($instance, $accessor)){ |
|
| 32 | $fkv=$instance->$accessor(); |
|
| 33 | $ret[$key]->addValue($fkv); |
|
| 34 | } |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * Prepares members associated with $instance with a oneToMany type relationship |
|
| @@ 122-140 (lines=19) @@ | ||
| 119 | * @param string $member Member on which a ManyToMany annotation must be present |
|
| 120 | * @param array $annot used internally |
|
| 121 | */ |
|
| 122 | protected static function prepareManyToMany(&$ret,$instance, $member, $annot=null) { |
|
| 123 | $class=get_class($instance); |
|
| 124 | if (!isset($annot)){ |
|
| 125 | $annot=OrmUtils::getAnnotationInfoMember($class, "#ManyToMany", $member); |
|
| 126 | } |
|
| 127 | if ($annot !== false) { |
|
| 128 | $key=$annot["targetEntity"]."|".$member."|".$annot["inversedBy"]; |
|
| 129 | if(!isset($ret[$key])){ |
|
| 130 | $parser=new ManyToManyParser($instance, $member); |
|
| 131 | $parser->init($annot); |
|
| 132 | $ret[$key]=$parser; |
|
| 133 | } |
|
| 134 | $accessor="get" . ucfirst($ret[$key]->getMyPk()); |
|
| 135 | if(method_exists($instance, $accessor)){ |
|
| 136 | $fkv=$instance->$accessor(); |
|
| 137 | $ret[$key]->addValue($fkv); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * Prepares members associated with $instance with a oneToMany type relationship |
|