コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function fromArray(array $array = array())
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'fromArray', array($array));
     return parent::fromArray($array);
 }
コード例 #2
0
 public function testCanUpdateOneToMany()
 {
     $article = new Article();
     $link0 = new \Shopware\Models\Article\Link();
     $link0->setName('dummy');
     $link0->setLink('lorem');
     $this->setProperty($link0, 'id', 1);
     $article->getLinks()->add($link0);
     $this->assertContains($link0, $article->getLinks());
     $data = array('links' => array(array('id' => 2, 'name' => 'batz')));
     $article->fromArray($data);
     $this->assertCount(1, $article->getLinks());
     $this->assertNotContains($link0, $article->getLinks());
     $this->assertEquals('batz', $article->getLinks()->first()->getName());
 }