PHP code example of carpehora / extrapropertiesbehavior
1. Go to this page and download the library: Download carpehora/extrapropertiesbehavior 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/ */
carpehora / extrapropertiesbehavior example snippets
php
$tvSet = new Product();
$tvSet->setName('My big TV');
$tvSet->setProperty('size', '12 inches');
$tvSet->setProperty('frequency', '11 Hz');
$tvSet->save();
$tvSet->getProperty('size'); // will result in '12 inches'
$tvSet->getProperty('frequency'); // will result in '11 Hz'
propel.ini
php
class User extends BaseUser
{
protected function initializeProperties()
{
$this->registerProperty('MY_MODULE_PREFERENCE', 'default_value');
}
}
php
class Article extends Content
{
protected function initializeProperties()
{
$this->registerProperty('CONTENT');
$this->registerProperty('AUTHOR');
}
public function getOMClass()
{
return 'Article';
}
}
php
class Video extends Content
{
protected function initializeProperties()
{
$this->registerProperty('URL');
$this->registerProperty('LENGTH');
}
public function getOMClass()
{
return 'Video';
}
}
php
$article = new Article();
$article->setTitle('Propel, greatest php ORM ever');
$article->setContent('Try it you\'ll see');
$article->save();
$video = new Video();
$video->setTitle('Propel + phpsh');
$video->setUrl('http://vimeo.com/15140218');
$video->setLength('2:01');
$video->save();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.