1. Go to this page and download the library: Download carrooi/favorites 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/ */
carrooi / favorites example snippets
namespace App\Model\Entities;
use Carrooi\Favorites\Model\Entities\IUserEntity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @author David Kudera
*/
class User implements IUserEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
* @var int
*/
private $id;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
}
namespace App\Model\Entities;
use Carrooi\Favorites\Model\Entities\IFavoritableEntity;
use Carrooi\Favorites\Model\Entities\TFavorites;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @author David Kudera
*/
class Article implements IFavoritableEntity
{
use TFavorites;
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
* @var int
*/
private $id;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
}
namespace App\Model\Entities;
use Carrooi\Favorites\Model\Entities\FavoriteItem;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @author David Kudera
*/
class FavoriteItem extends FavoriteItem
{
// ...
}
namespace App\Model\Entities;
use Carrooi\Favorites\Model\Entities\FavoriteItem;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @author David Kudera
*/
class FavoriteItem extends FavoriteItem
{
/** @var \App\Model\Entities\Article */
private $article;
/**
* @return \App\Model\Entities\Article
*/
public function getArticle()
{
return $this->article;
}
/**
* @param \App\Model\Entities\Article $article
* @return $this
*/
public function setArticle(Article $article)
{
$this->article = $article;
return $this;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.