Last active
August 29, 2015 13:56
-
-
Save Hounddog/9233738 to your computer and use it in GitHub Desktop.
Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$entityClass = $this->getEntityClass();//API\V1\Entity\Site | |
$entity = new $entityClass; | |
$hydrator = $this->getHydrator();//DoctrineModule\Stdlib\Hydrator\DoctrineObject | |
$hydrator->hydrate((array)$data, $entity); | |
//data | |
object(stdClass)#658 (2) { | |
["id"]=> | |
string(7) "testing" | |
["userId"]=> | |
string(8) "mshwalbe" | |
} | |
Entity of type API\\V1\\Entity\\Site is missing an assigned ID for field 'id'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API\V1\Entity\Site Object | |
( | |
[id:protected] => | |
[hashtags:protected] => Doctrine\Common\Collections\ArrayCollection Object | |
( | |
[_elements:Doctrine\Common\Collections\ArrayCollection:private] => Array | |
( | |
) | |
) | |
[userId:protected] => | |
[backgroundColor:protected] => | |
[headerBackgroundColor:protected] => | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace API\V1\Entity; | |
use Doctrine\ORM\Mapping AS ORM; | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** | |
* @package Model | |
* @version | |
* @ORM\Entity | |
* @ORM\Table(name="site") | |
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") | |
*/ | |
class Site | |
{ | |
/** | |
* @var String | |
* @ORM\Id @ORM\Column(name="id", type="string", length=128) | |
* | |
*/ | |
protected $id; | |
/** | |
* @var \Doctrine\Common\Collections\ArrayCollection | |
* @ORM\OneToMany(targetEntity="API\V1\Entity\HashTag", mappedBy="idSite") | |
**/ | |
protected $hashtags; | |
/** @ORM\Column(name="user_id", type="string", length=255, nullable=false) */ | |
protected $userId; | |
/** @ORM\Column(name="background_color", type="string", length=7, nullable=true) */ | |
protected $backgroundColor; | |
/** @ORM\Column(name="header_background_color", type="string", length=7, nullable=true) */ | |
protected $headerBackgroundColor; | |
public function __construct() { | |
$this->hashtags = new ArrayCollection(); | |
} | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function setId($id) | |
{ | |
$this->id = $id; | |
} | |
public function setHashtags($hashtags) | |
{ | |
$this->hashtags = $hashtags; | |
} | |
public function getHashtags() | |
{ | |
return $this->hashtags; | |
} | |
/** | |
* @return string $userId | |
*/ | |
public function getUserId() | |
{ | |
return $this->userId; | |
} | |
/** | |
* @param string $userId | |
* @return Site | |
*/ | |
public function setUserId($userId) | |
{ | |
echo 'set user id'; | |
exit; | |
$this->userId = $userId; | |
return $this; | |
} | |
/** | |
* @return string $backgroundColor | |
*/ | |
public function getBackgroundColor() | |
{ | |
return $this->backgroundColor; | |
} | |
/** | |
* @param string $backgroundColor | |
* @return Site | |
*/ | |
public function setBackgroundColor($backgroundColor) | |
{ | |
$this->backgroundColor = $backgroundColor; | |
return $this; | |
} | |
/** | |
* @return string $headerBackgroundColor | |
*/ | |
public function getHeaderBackgroundColor() | |
{ | |
return $this->headerBackgroundColor; | |
} | |
/** | |
* @param string $headerBackgroundColor | |
* @return Site | |
*/ | |
public function setHeaderBackgroundColor($headerBackgroundColor) | |
{ | |
$this->headerBackgroundColor = $headerBackgroundColor; | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment