| @@ 41-53 (lines=13) @@ | ||
| 38 | $this->context = $context; |
|
| 39 | } |
|
| 40 | ||
| 41 | public function prepareQuery($data) { |
|
| 42 | // @todo throw an exception when the data doesn't have the local key |
|
| 43 | $query = $this->getQuery(); |
|
| 44 | if($this->queryPrepared){ |
|
| 45 | $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]); |
|
| 46 | } else { |
|
| 47 | $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table']) |
|
| 48 | ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']]) |
|
| 49 | ->setFirstOnly(true); |
|
| 50 | $this->queryPrepared = true; |
|
| 51 | } |
|
| 52 | return $query; |
|
| 53 | } |
|
| 54 | ||
| 55 | public function runSetup() { |
|
| 56 | $model = $this->container->resolve($this->context->getClassName($this->options['model'], self::BELONGS_TO)); |
|
| @@ 41-53 (lines=13) @@ | ||
| 38 | $this->context = $context; |
|
| 39 | } |
|
| 40 | ||
| 41 | public function prepareQuery($data) |
|
| 42 | { |
|
| 43 | // @todo throw an exception when the data doesn't have the local key |
|
| 44 | $query = $this->getQuery(); |
|
| 45 | if($this->queryPrepared) { |
|
| 46 | $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]); |
|
| 47 | } else { |
|
| 48 | $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table']) |
|
| 49 | ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']]); |
|
| 50 | $this->queryPrepared = true; |
|
| 51 | } |
|
| 52 | return $query; |
|
| 53 | } |
|
| 54 | ||
| 55 | public function runSetup() |
|
| 56 | { |
|