PHP code example of xanweb / c5-entity
1. Go to this page and download the library: Download xanweb/c5-entity library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xanweb / c5-entity example snippets
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="MyEntityTable")
*/
class MyEntity extends \Xanweb\C5\Entity\EntityObject {
...
}
/**
* @method MyEntity createEntity()
* @method MyEntity create($data)
* @method MyEntity getByID($id)
* @method MyEntity[] getList()
*
* or if your IDE supports generic type
* @implements EntityService<MyEntity>
*/
class MyEntityService extends \Xanweb\C5\Entity\Service\EntityService {
/**
* {@inheritdoc}
*
* @see \Xanweb\C5\Entity\Service\EntityService::getEntityClass()
*/
public function getEntityClass(): string
{
return MyEntity::class;
}
}
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="MyEntityTable")
* @ORM\HasLifecycleCallbacks
*/
class MyEntity extends \Xanweb\C5\Entity\EntityObject {
use \Xanweb\C5\Entity\Traits\TimeStampableTrait;
...
}